Skip to content

Commit 2ca7137

Browse files
author
Daniel Kroening
authored
Merge pull request #25 from tautschnig/simplifier-20160305
Simplifier 20160305
2 parents d152d98 + e9ffa30 commit 2ca7137

8 files changed

+396
-320
lines changed

regression/cbmc/null3/main.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <assert.h>
2+
#include <stdlib.h>
3+
4+
struct S
5+
{
6+
int a;
7+
int b;
8+
};
9+
10+
int main()
11+
{
12+
struct S s;
13+
int* b_ptr=&(s.b);
14+
15+
if((size_t)((struct S*)0)!=0)
16+
return 1;
17+
18+
struct S* s_ptr=(struct S*)((char*)b_ptr - ((size_t) &((struct S*)0)->b));
19+
assert(s_ptr==&s);
20+
21+
return 0;
22+
}
23+

regression/cbmc/null3/test.desc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\(Starting CEGAR Loop\|^Generated 0 VCC(s), 0 remaining after simplification$\)
7+
^VERIFICATION SUCCESSFUL$
8+
--
9+
^warning: ignoring

src/goto-symex/symex_builtin_functions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ void goto_symext::symex_gcc_builtin_va_arg_next(
234234

235235
exprt tmp=code.op0();
236236
state.rename(tmp, ns); // to allow constant propagation
237+
do_simplify(tmp);
237238
irep_idt id=get_symbol(tmp);
238239

239240
exprt rhs=gen_zero(lhs.type());
@@ -346,6 +347,7 @@ void goto_symext::symex_printf(
346347

347348
exprt tmp_rhs=rhs;
348349
state.rename(tmp_rhs, ns);
350+
do_simplify(tmp_rhs);
349351

350352
const exprt::operandst &operands=tmp_rhs.operands();
351353
std::list<exprt> args;
@@ -391,6 +393,7 @@ void goto_symext::symex_input(
391393
{
392394
args.push_back(code.operands()[i]);
393395
state.rename(args.back(), ns);
396+
do_simplify(args.back());
394397
}
395398

396399
const irep_idt input_id=get_string_argument(id_arg, ns);
@@ -427,6 +430,7 @@ void goto_symext::symex_output(
427430
{
428431
args.push_back(code.operands()[i]);
429432
state.rename(args.back(), ns);
433+
do_simplify(args.back());
430434
}
431435

432436
const irep_idt output_id=get_string_argument(id_arg, ns);

0 commit comments

Comments
 (0)