diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-05-21 15:42:26 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2012-05-21 15:42:26 +0100 |
commit | 01c7ccbb81d2ee750e30cc8bf10deb9ed07e7bf0 (patch) | |
tree | 746a126e6805e769beb0a23355c6aa9772f179b2 | |
parent | 7772bae06caa4eb496d417efe23e9bb33693dc3c (diff) | |
download | gcc-01c7ccbb81d2ee750e30cc8bf10deb9ed07e7bf0.tar.gz |
re PR c/53418 (ICE at gimplify.c:7773)
PR c/53148
* c-typeck.c (build_conditional_expr): Remove C_MAYBE_CONST_EXPR
from folded operands before wrapping another around the
conditional expression.
testsuite:
* gcc.c-torture/compile/pr53418-1.c,
gcc.c-torture/compile/pr53418-2.c: New tests.
From-SVN: r187718
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-typeck.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr53418-1.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr53418-2.c | 5 |
5 files changed, 28 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d7bdb9916e6..d4f6e5fda55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2012-05-21 Joseph Myers <joseph@codesourcery.com> + + PR c/53148 + * c-typeck.c (build_conditional_expr): Remove C_MAYBE_CONST_EXPR + from folded operands before wrapping another around the + conditional expression. + 2012-05-21 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/53366 diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index f45d1dcc342..0398b755cf7 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -4408,6 +4408,11 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp, ret = fold_build3_loc (colon_loc, COND_EXPR, result_type, ifexp, op1, op2); else { + if (int_operands) + { + op1 = remove_c_maybe_const_expr (op1); + op2 = remove_c_maybe_const_expr (op2); + } ret = build3 (COND_EXPR, result_type, ifexp, op1, op2); if (int_operands) ret = note_integer_operands (ret); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f1bcb48b3e..718fe466992 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-05-21 Joseph Myers <joseph@codesourcery.com> + + PR c/53148 + * gcc.c-torture/compile/pr53418-1.c, + gcc.c-torture/compile/pr53418-2.c: New tests. + 2012-05-21 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/53366 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c b/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c new file mode 100644 index 00000000000..721b02d7878 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c @@ -0,0 +1,5 @@ +void +f (void) +{ + int i = (0 ? 1 : 0U / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c b/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c new file mode 100644 index 00000000000..a437b6a0e62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c @@ -0,0 +1,5 @@ +void +f (void) +{ + int i = (1 ? 0U / 0 : 1); +} |