]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c/53418 (ICE at gimplify.c:7773)
authorRichard Guenther <rguenther@suse.de>
Wed, 20 Jun 2012 14:39:36 +0000 (14:39 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 20 Jun 2012 14:39:36 +0000 (14:39 +0000)
2012-06-20  Richard Guenther  <rguenther@suse.de>

Backport from mainline
2012-05-21  Joseph Myers  <joseph@codesourcery.com>

PR c/53418
* c-typeck.c (build_conditional_expr): Remove C_MAYBE_CONST_EXPR
from folded operands before wrapping another around the
conditional expression.

* gcc.c-torture/compile/pr53418-1.c,
gcc.c-torture/compile/pr53418-2.c: New tests.

From-SVN: r188837

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr53418-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/pr53418-2.c [new file with mode: 0644]

index 4ea22dc71a02465207762bb79393219398f0eac5..ce6d650594737a6ba82e909b33c47eadd16b1049 100644 (file)
@@ -1,3 +1,13 @@
+2012-06-20  Richard Guenther  <rguenther@suse.de>
+
+       Backport from mainline
+       2012-05-21  Joseph Myers  <joseph@codesourcery.com>
+
+       PR c/53418
+       * c-typeck.c (build_conditional_expr): Remove C_MAYBE_CONST_EXPR
+       from folded operands before wrapping another around the
+       conditional expression.
+
 2012-06-20  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
index 66b95127aba531b425d2141fe5096eb5c2c81654..95c0353d20e7607a679912c98e9846343bd7f2de 100644 (file)
@@ -4219,6 +4219,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);
index d682c613034e1fa7a53852b084dcfadcb1d479c8..b10fd95ef164cd758337d20e37f9b5568e138b1b 100644 (file)
@@ -1,3 +1,12 @@
+2012-06-20  Richard Guenther  <rguenther@suse.de>
+
+       Backport from mainline
+       2012-05-21  Joseph Myers  <joseph@codesourcery.com>
+
+       PR c/53418
+       * gcc.c-torture/compile/pr53418-1.c,
+       gcc.c-torture/compile/pr53418-2.c: New tests.
+
 2012-06-20  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
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 (file)
index 0000000..721b02d
--- /dev/null
@@ -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 (file)
index 0000000..a437b6a
--- /dev/null
@@ -0,0 +1,5 @@
+void
+f (void)
+{
+  int i = (1 ? 0U / 0 : 1);
+}