re PR middle-end/65555 (ICE: verify_gimple failed (LHS in noreturn call))
authorRichard Biener <rguenther@suse.de>
Thu, 26 Mar 2015 14:22:57 +0000 (14:22 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 26 Mar 2015 14:22:57 +0000 (14:22 +0000)
2015-03-26  Richard Biener  <rguenther@suse.de>

PR middle-end/65555
* tree-cfg.c (verify_gimple_call): Do not require a call to
have no LHS if it wasn't recognized as control altering yet.

* g++.dg/torture/pr65555.C: New testcase.

From-SVN: r221697

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr65555.C [new file with mode: 0644]
gcc/tree-cfg.c

index 6a1a43fa2858083f52b186020e659dab14730e94..f9ea6a0891fe3f74cf48f76a4b6ee4ee1c2a9ce4 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-26  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/65555
+       * tree-cfg.c (verify_gimple_call): Do not require a call to
+       have no LHS if it wasn't recognized as control altering yet.
+
 2015-03-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/64715
index a0fb7634d51279a3f56c5525b86566e93979059d..226ac2ac18ca137bfaf773ce090873e76a7d0b40 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-26  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/65555
+       * g++.dg/torture/pr65555.C: New testcase.
+
 2015-03-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/64715
diff --git a/gcc/testsuite/g++.dg/torture/pr65555.C b/gcc/testsuite/g++.dg/torture/pr65555.C
new file mode 100644 (file)
index 0000000..9027c69
--- /dev/null
@@ -0,0 +1,11 @@
+// { dg-do compile }
+
+class basic_ostream {
+public:
+    basic_ostream &operator<<(basic_ostream &p1(basic_ostream &)) {
+       return p1(*this);
+    }
+} a;
+void fn1() __attribute__((__noreturn__));
+basic_ostream &fn2(basic_ostream &) { fn1(); }
+void fn3() { a << fn2; }
index 98d6ba448faf629b20f83c24ace7b072a02b0e4f..64bdc92e681026ea0d6e47208e35e3212c684722 100644 (file)
@@ -3335,7 +3335,9 @@ verify_gimple_call (gcall *stmt)
       return true;
     }
 
-  if (gimple_call_lhs (stmt) && gimple_call_noreturn_p (stmt))
+  if (gimple_call_ctrl_altering_p (stmt)
+      && gimple_call_lhs (stmt)
+      && gimple_call_noreturn_p (stmt))
     {
       error ("LHS in noreturn call");
       return true;