From 1e867b228fc67a773e682bfd75ebd6ea3ce0a95e Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 13 Apr 2012 09:24:28 +0000 Subject: [PATCH] re PR c/52549 (ice in pointer_diff) 2012-04-13 Richard Guenther PR c/52549 * c-typeck.c (pointer_diff): Remove bogus assert. * gcc.dg/pr52549.c: New testcase. From-SVN: r186408 --- gcc/ChangeLog | 5 +++++ gcc/c-typeck.c | 2 -- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr52549.c | 6 ++++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr52549.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d161985b518..fdff5a76707 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-04-13 Richard Guenther + + PR c/52549 + * c-typeck.c (pointer_diff): Remove bogus assert. + 2012-04-13 Richard Guenther PR c/52862 diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 9891348029c..e7060e2c3d2 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -3446,8 +3446,6 @@ pointer_diff (location_t loc, tree op0, tree op1) else con1 = op1; - gcc_assert (TREE_CODE (con0) != PLUS_EXPR - && TREE_CODE (con1) != PLUS_EXPR); if (TREE_CODE (con0) == POINTER_PLUS_EXPR) { lit0 = TREE_OPERAND (con0, 1); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 23608c58065..9abfbd3bded 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-04-13 Richard Guenther + + PR c/52549 + * gcc.dg/pr52549.c: New testcase. + 2012-04-13 Richard Guenther PR c/52862 diff --git a/gcc/testsuite/gcc.dg/pr52549.c b/gcc/testsuite/gcc.dg/pr52549.c new file mode 100644 index 00000000000..89ec2aaf6cc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr52549.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ + +_mark (long obj, int i, char *a) +{ + (char *)&(((long *)(obj)) [i]) - a; +}