re PR tree-optimization/42806 ("-fcompare-debug failure (length)" at -O1 in recent...
authorRichard Guenther <rguenther@suse.de>
Tue, 26 Jan 2010 15:09:43 +0000 (15:09 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 26 Jan 2010 15:09:43 +0000 (15:09 +0000)
2010-01-26  Richard Guenther  <rguenther@suse.de>

PR middle-end/42806
* tree-eh.c (unsplit_eh): Skip debug insns.

* g++.dg/other/pr42806.C: New testcase.

From-SVN: r156249

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/pr42806.C [new file with mode: 0644]
gcc/tree-eh.c

index da237e7e57d1d5478295cbc8c1b281493ba5a90a..5d34ebb7ebf583cb739fa576cfc8a17b6044bcb1 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-26  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/42806
+       * tree-eh.c (unsplit_eh): Skip debug insns.
+
 2010-01-26  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/42250
index 3cdaee3ea39820e9330c4b5d2f69248699e1f382..0238f4c71f79f27e6b483fd1bfde02da4fbad400 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-26  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/42806
+       * g++.dg/other/pr42806.C: New testcase.
+
 2010-01-26  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/42250
diff --git a/gcc/testsuite/g++.dg/other/pr42806.C b/gcc/testsuite/g++.dg/other/pr42806.C
new file mode 100644 (file)
index 0000000..9823238
--- /dev/null
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-O -fcompare-debug" }
+
+struct S1 {
+    ~S1() { }
+};
+
+struct S2 {
+    S1 s1;
+    void m();
+    ~S2() { m(); }
+};
+
+struct S3 {
+    S3(int, S2);
+};
+
+void foo()
+{
+  S3(0, S2());
+}
+
index 1a9e7b50e6a5021bde8bd1c91c96115c9e5f70e1..2cb334ff0d491c63b4e3a6efa978d0cb60702f2f 100644 (file)
@@ -3350,8 +3350,11 @@ unsplit_eh (eh_landing_pad lp)
   if ((e_in->flags & EDGE_EH) == 0 || (e_out->flags & EDGE_EH) != 0)
     return false;
 
-  /* The block must be empty except for the labels.  */
-  if (!gsi_end_p (gsi_after_labels (bb)))
+  /* The block must be empty except for the labels and debug insns.  */
+  gsi = gsi_after_labels (bb);
+  if (!gsi_end_p (gsi) && is_gimple_debug (gsi_stmt (gsi)))
+    gsi_next_nondebug (&gsi);
+  if (!gsi_end_p (gsi))
     return false;
 
   /* The destination block must not already have a landing pad