re PR middle-end/71308 (ICE (segfault) in in gimple_fold_call gimple-fold.c:3060)
authorMarek Polacek <polacek@redhat.com>
Fri, 27 May 2016 12:08:03 +0000 (12:08 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 27 May 2016 12:08:03 +0000 (12:08 +0000)
PR middle-end/71308
* gimple-fold.c (gimple_fold_call): Check that LHS is not null.

* g++.dg/torture/pr71308.C: New test.

From-SVN: r236815

gcc/ChangeLog
gcc/gimple-fold.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr71308.C [new file with mode: 0644]

index 67a20e9eeec6bebe94f80f0938dec2436b0acaa8..14ba165d82c034923121f783b1750ce40084fa61 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-27  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/71308
+       * gimple-fold.c (gimple_fold_call): Check that LHS is not null.
+
 2016-05-27  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
        * config/s390/s390.md (2x risbg splitters): Use
index d6657e9079958cc0ebcda332673f7493275042ec..600aa72f217185f17230d4bf774f2b66e7e5aa85 100644 (file)
@@ -3053,7 +3053,8 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace)
                          == void_type_node))
                    gimple_call_set_fntype (stmt, TREE_TYPE (fndecl));
                  /* If the call becomes noreturn, remove the lhs.  */
-                 if (gimple_call_noreturn_p (stmt)
+                 if (lhs
+                     && gimple_call_noreturn_p (stmt)
                      && (VOID_TYPE_P (TREE_TYPE (gimple_call_fntype (stmt)))
                          || should_remove_lhs_p (lhs)))
                    {
index c209d98a547c6f321f6f689bce3bef57860f5ace..e556f3a3ba2aadba8738d125e38312da0dc63889 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-27  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/71308
+       * g++.dg/torture/pr71308.C: New test.
+
 2016-05-27  Dominik Vogt  <vogt@linux.vnet.ibm.com>
 
        * gcc.dg/zero_bits_compound-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/torture/pr71308.C b/gcc/testsuite/g++.dg/torture/pr71308.C
new file mode 100644 (file)
index 0000000..ff5cd95
--- /dev/null
@@ -0,0 +1,18 @@
+// PR middle-end/71308
+// { dg-do compile }
+
+class S
+{
+  void foo ();
+  virtual void bar () = 0;
+  virtual ~S ();
+};
+inline void
+S::foo ()
+{
+  bar ();
+};
+S::~S ()
+{
+  foo ();
+}