Skip to content

Commit b0352f9

Browse files
committed
Simplifier: in pointer-typed (a + b) + c the pointer may be c
The rewrite tries to combine the integer-typed operands; if c is the pointer, then (a + b) is already of the right form and no changes are needed.
1 parent f37741f commit b0352f9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE
22
main.c
33

44
^EXIT=10$
@@ -7,5 +7,5 @@ main.c
77
--
88
^warning: ignoring
99
--
10-
Symbolic execution currently messes up the typing in "p = a + b + p;" making the
10+
The simplifier previously messed up the typing in "p = a + b + p;" making the
1111
right-hand side signed long rather than a pointer.

src/util/simplify_expr_int.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ bool simplify_exprt::simplify_plus(exprt &expr)
479479
if(expr.type().id()==ID_pointer &&
480480
expr.operands().size()==2 &&
481481
expr.op0().id()==ID_plus &&
482+
expr.op0().type().id() == ID_pointer &&
482483
expr.op0().operands().size()==2)
483484
{
484485
exprt op0=expr.op0();

0 commit comments

Comments
 (0)