re PR tree-optimization/93054 (ICE in gimple_set_lhs, at gimple.c:1820)
authorRichard Biener <rguenther@suse.de>
Thu, 9 Jan 2020 10:41:38 +0000 (10:41 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 9 Jan 2020 10:41:38 +0000 (10:41 +0000)
2020-01-09  Richard Biener  <rguenther@suse.de>

PR middle-end/93054
* gimplify.c (gimplify_expr): Deal with NOP definitions.

* gcc.dg/pr93054.c: New testcase.

From-SVN: r280039

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr93054.c [new file with mode: 0644]

index dbac2a41cfaf1acbc40d4d4848ebcaac419745d4..2339a87f99bf6593b5f9908c977a29bf17df2686 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-09  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/93054
+       * gimplify.c (gimplify_expr): Deal with NOP definitions.
+
 2020-01-09  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/93040
index 73fb2e7cd7eff808931574fd9cd1bf04672a93a5..4243d3a83b849dda3c66e6b23fb0af8010480352 100644 (file)
@@ -14622,7 +14622,8 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
        {
          /* Avoid the extra copy if possible.  */
          *expr_p = create_tmp_reg (TREE_TYPE (name));
-         gimple_set_lhs (SSA_NAME_DEF_STMT (name), *expr_p);
+         if (!gimple_nop_p (SSA_NAME_DEF_STMT (name)))
+           gimple_set_lhs (SSA_NAME_DEF_STMT (name), *expr_p);
          release_ssa_name (name);
        }
     }
index 0e18082a829e019f21b9b28c2bdd9499b2046f74..71106d10033be579656210b8246dc1898289ad30 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-09  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/93054
+       * gcc.dg/pr93054.c: New testcase.
+
 2020-01-09  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/93040
diff --git a/gcc/testsuite/gcc.dg/pr93054.c b/gcc/testsuite/gcc.dg/pr93054.c
new file mode 100644 (file)
index 0000000..1d4680d
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+__attribute__ ((returns_twice)) int
+bp (int);
+
+__attribute__ ((noreturn)) int
+cb (void)
+{
+  return bp (cb ()); /* { dg-warning "declared .noreturn." } */
+}