re PR c/84873 (ICE: verify_ssa failed (error: definition in block 3 does not dominate...
authorRichard Biener <rguenther@suse.de>
Thu, 15 Mar 2018 13:10:24 +0000 (13:10 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 15 Mar 2018 13:10:24 +0000 (13:10 +0000)
2018-03-15  Richard Biener  <rguenther@suse.de>

PR c/84873
* c-gimplify.c (c_gimplify_expr): Do not fold expressions.

* c-c++-common/pr84873.c: New testcase.

From-SVN: r258556

gcc/c-family/ChangeLog
gcc/c-family/c-gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr84873.c [new file with mode: 0644]

index 10c70476d913de47416b92f41fd7459a82540cb9..a03ff86e57b31d6d6753622a369d3ee5f70a0803 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-15  Richard Biener  <rguenther@suse.de>
+
+       PR c/84873
+       * c-gimplify.c (c_gimplify_expr): Do not fold expressions.
+
 2018-03-13  Martin Sebor  <msebor@redhat.com>
 
        PR tree-optimization/84725
index 344c0add48c7917074ce9400da778c8a63cd8e77..e6b90ef95b6123c25e0fbfb3c2d024de9a85a7a7 100644 (file)
@@ -245,7 +245,15 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
                                    unsigned_type_node)
            && !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)),
                                    integer_type_node))
-         *op1_p = convert (unsigned_type_node, *op1_p);
+         {
+           /* ???  Do not use convert () here or fold arbitrary trees
+              since folding can introduce tree sharing which is not
+              allowed during gimplification.  */
+           if (TREE_CODE (*op1_p) == INTEGER_CST)
+             *op1_p = fold_convert (unsigned_type_node, *op1_p);
+           else
+             *op1_p = build1 (NOP_EXPR, unsigned_type_node, *op1_p);
+         }
        break;
       }
 
index 4d6379de3f41d9cdd288a53adc14e2847e497b5f..77d090a988070117815444aa6ad475dd71666b99 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-15  Richard Biener  <rguenther@suse.de>
+
+       PR c/84873
+       * c-c++-common/pr84873.c: New testcase.
+
 2018-03-15  Tamar Christina  <tamar.christina@arm.com>
 
        PR target/84711
diff --git a/gcc/testsuite/c-c++-common/pr84873.c b/gcc/testsuite/c-c++-common/pr84873.c
new file mode 100644 (file)
index 0000000..5eb8a8d
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-frounding-math" } */
+
+int
+i1 (int w3, int n9)
+{
+  return w3 >> ((long int)(1 + 0.1) + -!n9);
+}