Skip to content

Commit 048caed

Browse files
author
Daniel Kroening
authored
Merge pull request #3727 from diffblue/uf-test
fix for uninterpreted functions
2 parents f44baa8 + 0f74979 commit 048caed

File tree

6 files changed

+50
-6
lines changed

6 files changed

+50
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
_Bool __CPROVER_uninterpreted_f();
2+
3+
main()
4+
{
5+
_Bool a = __CPROVER_uninterpreted_f();
6+
assert(0);
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
uf1.c
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
^warning: ignoring
9+
--
10+
Basic test for an uninterpreted function; based on issue #3561.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
int __CPROVER_uninterpreted_f(int, int);
2+
3+
main()
4+
{
5+
int a, b;
6+
7+
int inst1 = __CPROVER_uninterpreted_f(1, a);
8+
int inst2 = __CPROVER_uninterpreted_f(1, b);
9+
10+
if(a == b)
11+
__CPROVER_assert(inst1 == inst2, "functional consistency");
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
uf2.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
9+
--
10+
Basic test for an uninterpreted function.

scripts/delete_failing_smt2_solver_tests

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ rm struct6/test.desc
7474
rm struct7/test.desc
7575
rm trace-values/trace-values.desc
7676
rm trace_show_function_calls/test.desc
77+
rm uninterpreted_function/uf1.desc
78+
rm uninterpreted_function/uf2.desc
7779
rm union12/test.desc
7880
rm union6/test.desc
7981
rm union7/test.desc

src/goto-symex/build_goto_trace.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,16 @@ void set_internal_dynamic_object(
111111
{
112112
if(expr.id()==ID_symbol)
113113
{
114-
const irep_idt &id=to_ssa_expr(expr).get_original_name();
115-
const symbolt *symbol;
116-
if(!ns.lookup(id, symbol))
114+
if(expr.type().id() != ID_code)
117115
{
118-
bool result = symbol->type.get_bool(ID_C_dynamic);
119-
if(result)
120-
goto_trace_step.internal=true;
116+
const irep_idt &id = to_ssa_expr(expr).get_original_name();
117+
const symbolt *symbol;
118+
if(!ns.lookup(id, symbol))
119+
{
120+
bool result = symbol->type.get_bool(ID_C_dynamic);
121+
if(result)
122+
goto_trace_step.internal = true;
123+
}
121124
}
122125
}
123126
else

0 commit comments

Comments
 (0)