re PR c/48685 (ICE in gimplify_expr, at gimplify.c:7034)
authorJakub Jelinek <jakub@redhat.com>
Sat, 23 Apr 2011 10:18:03 +0000 (12:18 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 23 Apr 2011 10:18:03 +0000 (12:18 +0200)
PR c/48685
* fold-const.c (fold_convert_loc): Add NOP_EXPR when casting
to VOID_TYPE even around MODIFY_EXPR.

* gcc.dg/pr48685.c: New test.

From-SVN: r172895

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr48685.c [new file with mode: 0644]

index edff5052b18e9bf5fd280876d0a1e63c604a4ad1..4d7c511ccbe36b1872778365b5b81ae0d2d21c35 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/48685
+       * fold-const.c (fold_convert_loc): Add NOP_EXPR when casting
+       to VOID_TYPE even around MODIFY_EXPR.
+
 2011-04-22  Mike Stump  <mikestump@comcast.net>
 
        * gensupport.c (read_md_rtx): Fix typo in comment.
index c4bf08819b38002087f4619c5336768da7cdd4f9..8f90f6f108afd66aca62e99e7738fc7069b72a48 100644 (file)
@@ -2029,8 +2029,6 @@ fold_convert_loc (location_t loc, tree type, tree arg)
 
     case VOID_TYPE:
       tem = fold_ignored_result (arg);
-      if (TREE_CODE (tem) == MODIFY_EXPR)
-       goto fold_convert_exit;
       return fold_build1_loc (loc, NOP_EXPR, type, tem);
 
     default:
index 40b9e6d590075389883478573f19ced33592d47c..08aa6d48241f9198345b38973224d1f10e1275bc 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/48685
+       * gcc.dg/pr48685.c: New test.
+
 2011-04-22  Jan Hubicka  <jh@suse.cz>
 
        * gcc.dg/tree-ssa/pr38699.c: Fix testcase.
diff --git a/gcc/testsuite/gcc.dg/pr48685.c b/gcc/testsuite/gcc.dg/pr48685.c
new file mode 100644 (file)
index 0000000..36df0cc
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR c/48685 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+main ()
+{
+  int v = 1;
+  (void) (1 == 2 ? (void) 0 : (v = 0));
+  return v;
+}