diff options
author | Bernd Schmidt <bernds@codesourcery.com> | 2012-03-05 22:48:30 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2012-03-05 22:48:30 +0000 |
commit | 5de724244f16e91b67997df6edab0faad7b2c97d (patch) | |
tree | 77850bb4d302465d2610548d53daf2f17b21be6b /gcc | |
parent | 3b1552c135cab470886c2593f2cc0895ba74c0e1 (diff) | |
download | gcc-5de724244f16e91b67997df6edab0faad7b2c97d.zip gcc-5de724244f16e91b67997df6edab0faad7b2c97d.tar.gz gcc-5de724244f16e91b67997df6edab0faad7b2c97d.tar.bz2 |
c-typeck.c (pointer_diff): Check for POINTER_PLUS_EXPR, not PLUS_EXPR.
* c-typeck.c (pointer_diff): Check for POINTER_PLUS_EXPR, not
PLUS_EXPR.
From-SVN: r184965
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-typeck.c | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad4bfb0..8897a63 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-03-05 Bernd Schmidt <bernds@codesourcery.com> + + * c-typeck.c (pointer_diff): Check for POINTER_PLUS_EXPR, not + PLUS_EXPR. + 2012-03-05 Richard Henderson <rth@redhat.com> * genemit.c (main): Include "target.h" in insn-emit.c. diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 2de1e5c..61bb8fd 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -3447,7 +3447,9 @@ pointer_diff (location_t loc, tree op0, tree op1) else con1 = op1; - if (TREE_CODE (con0) == PLUS_EXPR) + gcc_assert (TREE_CODE (con0) != PLUS_EXPR + && TREE_CODE (con1) != PLUS_EXPR); + if (TREE_CODE (con0) == POINTER_PLUS_EXPR) { lit0 = TREE_OPERAND (con0, 1); con0 = TREE_OPERAND (con0, 0); @@ -3455,7 +3457,7 @@ pointer_diff (location_t loc, tree op0, tree op1) else lit0 = integer_zero_node; - if (TREE_CODE (con1) == PLUS_EXPR) + if (TREE_CODE (con1) == POINTER_PLUS_EXPR) { lit1 = TREE_OPERAND (con1, 1); con1 = TREE_OPERAND (con1, 0); |