Skip to content

Commit a530496

Browse files
author
thk123
committed
Merge remote-tracking branch 'thk123/bugfix/partial-expression-simplification' into release/release-16
2 parents fa86451 + de2f979 commit a530496

File tree

5 files changed

+69
-2
lines changed

5 files changed

+69
-2
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
extern int arr[];
2+
3+
void main()
4+
{
5+
int index=0;
6+
int j=arr[index];
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CORE
2+
main.c
3+
"--variable --arrays"
4+
5+
arr\[0l\]

src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)