]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/29610 (ICE when compiling c++ code with -O2 -funswitch-loops)
authorRichard Guenther <rguenther@suse.de>
Tue, 7 Nov 2006 17:29:34 +0000 (17:29 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 7 Nov 2006 17:29:34 +0000 (17:29 +0000)
2006-11-07  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/29610
* tree-cfgcleanup.c (cleanup_control_flow): Honor return value
of tree_purge_dead_eh_edges as it may free dominators.

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

From-SVN: r118555

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

index ae1706c3fdc5d4daeea35f09dee8130c9311fb41..a35e5d9b1792f19a030c66c98f6831a4aa69f5a0 100644 (file)
@@ -1,3 +1,11 @@
+2006-11-07  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/29610
+       * tree-cfgcleanup.c (cleanup_control_flow): Honor return value
+       of tree_purge_dead_eh_edges as it may free dominators.
+
+       * g++.dg/other/pr29610.C: New testcase.
+
 2006-11-07  David Ung  <davidu@mips.com>
 
        * config/mips/mips.c (mips_rtx_cost_optimize_size): New table of
diff --git a/gcc/testsuite/g++.dg/other/pr29610.C b/gcc/testsuite/g++.dg/other/pr29610.C
new file mode 100644 (file)
index 0000000..6566fb9
--- /dev/null
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -funswitch-loops" } */
+
+struct __normal_iterator 
+{
+  typedef int*const *_Iterator;
+  int*const * _M_current;
+  __normal_iterator(const _Iterator& __i) : _M_current(__i){}
+  const _Iterator& base() const {}
+};
+struct string { ~string(){} };
+struct vector 
+{
+  int** _M_finish;
+  __normal_iterator end() const   { return __normal_iterator (_M_finish); }
+  int size() const   { return end().base() - end().base(); }
+};
+class Painter
+{
+  int redraw_window(void);
+  typedef int (Painter::* SliceWindowFunc)(void);
+  int for_each(vector&, SliceWindowFunc);
+  void tcl_command(void);
+};
+inline int Painter::for_each(vector &layout, SliceWindowFunc func)
+{
+    for (unsigned int window = 0; window < layout.size();++window)
+        (this->*func)();
+}
+int t;
+int Painter::redraw_window(void) {t = 1;}
+string t2(int);
+vector *g(const string&);
+void Painter::tcl_command(void)
+{
+     for_each(*g(t2(2)), &Painter::redraw_window);
+}
+
index be90209d3be65ad1a7cf521d334ca9ea0fd4bfb3..dbcfd4d2a3479899cc674843dd204caf76045c37 100644 (file)
@@ -160,7 +160,7 @@ cleanup_control_flow (void)
 
       /* If the last statement of the block could throw and now cannot,
         we need to prune cfg.  */
-      tree_purge_dead_eh_edges (bb);
+      retval |= tree_purge_dead_eh_edges (bb);
 
       if (bsi_end_p (bsi))
        continue;