Skip to content

Commit d8ad34f

Browse files
committed
Add test for fixing of referencing of static symbols in harness file.
1 parent 3b2494f commit d8ad34f

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include "first_one.h"
2+
#include <assert.h>
3+
4+
static int static_function(int a)
5+
{
6+
assert(a == 0);
7+
return a;
8+
}
9+
10+
int non_static_function(int a)
11+
{
12+
return static_function(a);
13+
}
14+
15+
static int with_matching_signature(int a)
16+
{
17+
assert(0 && "this is not reachable as far as goto-harness is concerned");
18+
return 0;
19+
}
20+
21+
void non_static_with_non_matching_signature(void)
22+
{
23+
// this is just here so `static_with_matching_signature` has a non-file-local use
24+
assert(static_with_matching_signature(10) == 10);
25+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int non_static_function(int a);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include "first_one.h"
2+
3+
int another(int (*fun_ptr)(int), int c)
4+
{
5+
int a = (*fun_ptr)(c);
6+
7+
return a;
8+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CORE
2+
dummy.c
3+
--function another --harness-type call-function
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
\[static_function\.assertion\.1\] line \d assertion a == 0: FAILURE
7+
\[non_static_with_non_matching_signature\.assertion\.1] line \d+ assertion static_with_matching_signature\(10\) == 10: SUCCESS
8+
9+
^VERIFICATION FAILED$
10+
--
11+
^CONVERSION ERROR$
12+
--
13+
For this particular error, we care mostly that goto-harness
14+
doesn't reference static symbols in other files, which would
15+
cause analysis through CBMC to fail with a conversion error.

0 commit comments

Comments
 (0)