Skip to content

Commit c037f34

Browse files
committed
deeply nested expression evaluation test
1 parent ec138f1 commit c037f34

File tree

2 files changed

+52
-0
lines changed
  • regression/goto-analyzer-simplify/simplify-deeply-nested-expression

2 files changed

+52
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
int nondet_int(void);
2+
3+
struct MH
4+
{
5+
int s;
6+
int t;
7+
int to;
8+
int su;
9+
};
10+
11+
int main(void)
12+
{
13+
int l = nondet_int();
14+
int s = nondet_int();
15+
int n = nondet_int();
16+
int o = nondet_int();
17+
int nt = nondet_int();
18+
int ns = nondet_int();
19+
20+
struct MH mh;
21+
mh.s = nondet_int();
22+
mh.t = nondet_int();
23+
mh.to = nondet_int();
24+
mh.su = nondet_int();
25+
26+
int result =
27+
((l >= mh.s ? 1 : 0) &
28+
(((mh.s >= s ? 1 : 0) &
29+
(((n >= mh.t ? 1 : 0) &
30+
(((mh.t >= o ? 1 : 0) & ((((int)mh.to == (int)nt ? 0 : 1) &
31+
((int)mh.su == (int)ns ? 0 : 1)) == 0
32+
? 0
33+
: 1)) == 0
34+
? 0
35+
: 1)) == 0
36+
? 0
37+
: 1)) == 0
38+
? 0
39+
: 1)) == 0;
40+
41+
assert(result = 0);
42+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--vsd
4+
^SIGNAL=0$
5+
^EXIT=0$
6+
--
7+
--
8+
This expression is derived from a real system under test. Due to inadvertent reevaluation of expression operands, all expression evaluations had geometric complexity (even more so in the presence of TOP values). This particular expression took nearly two hours to evaluate. Reworking to prevent repeated reevaluation brings this down to a few tenths.
9+
See https://github.com/diffblue/cbmc/pull/6290
10+
If this test appears to hang, the constant_evaluator is probably your first port of call.

0 commit comments

Comments
 (0)