File tree Expand file tree Collapse file tree 5 files changed +69
-2
lines changed
regression/goto-analyzer-simplify
src/analyses/variable-sensitivity Expand file tree Collapse file tree 5 files changed +69
-2
lines changed Original file line number Diff line number Diff line change 1+
2+ default : tests.log
3+
4+ test :
5+ @if ! ../test.pl -c ../chain.sh ; then \
6+ ../failed-tests-printer.pl ; \
7+ exit 1; \
8+ fi
9+
10+ tests.log :
11+ @if ! ../test.pl -c ../chain.sh ; then \
12+ ../failed-tests-printer.pl ; \
13+ exit 1; \
14+ fi
15+
16+ show :
17+ @for dir in * ; do \
18+ if [ -d " $$ dir" ]; then \
19+ vim -o " $$ dir/*.c" " $$ dir/*.out" ; \
20+ fi ; \
21+ done ;
22+
23+ clean :
24+ @for dir in * ; do \
25+ rm -f tests.log; \
26+ if [ -d " $$ dir" ]; then \
27+ cd " $$ dir" ; \
28+ rm -f * .out * .gb; \
29+ cd ..; \
30+ fi \
31+ done
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ src_dir=../../../src
4+
5+ goto_analyzer=$src_dir /goto-analyzer/goto-analyzer
6+
7+ options=$1
8+ file_name=${2% .c}
9+
10+ echo options: $options
11+ echo file name : $file_name
12+
13+ $goto_analyzer $file_name .c $options --simplify $file_name_simp .out
14+ $goto_analyzer $file_name_simp .out --show-goto-functions
Original file line number Diff line number Diff line change 1+ extern int arr [];
2+
3+ void main ()
4+ {
5+ int index = 0 ;
6+ int j = arr [index ];
7+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ "--variable --arrays"
4+
5+ arr\[0l\]
Original file line number Diff line number Diff line change @@ -295,8 +295,18 @@ bool variable_sensitivity_domaint::ai_simplify(
295295 sharing_ptrt<abstract_objectt> res=abstract_state.eval (condition, ns);
296296 exprt c=res->to_constant ();
297297
298- if (c.id ()==ID_nil) // TODO : simplification within an expression
299- return true ;
298+ if (c.id ()==ID_nil)
299+ {
300+ bool no_simplification=true ;
301+
302+ // Try to simplify recursively any child operations
303+ for (exprt &op : condition.operands ())
304+ {
305+ no_simplification&=ai_simplify (op, ns);
306+ }
307+
308+ return no_simplification;
309+ }
300310 else
301311 {
302312 bool condition_changed=(condition!=c);
You can’t perform that action at this time.
0 commit comments