This fixes PR51903, bootstrapped and tested on x86_64-unknown-linnux-gnu,
installed.

Richard.

2012-01-20  Richard Guenther  <rguent...@suse.de>

        PR tree-optimization/51903
        * tree-ssa-pre.c (eliminate): Properly purging of EH edges
        when removing stmts.

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

Index: gcc/tree-ssa-pre.c
===================================================================
*** gcc/tree-ssa-pre.c  (revision 183296)
--- gcc/tree-ssa-pre.c  (working copy)
*************** eliminate (void)
*** 4541,4548 ****
          gsi = gsi_for_stmt (stmt);
          unlink_stmt_vdef (stmt);
          gsi_remove (&gsi, true);
!         if (gimple_purge_dead_eh_edges (bb))
!           todo |= TODO_cleanup_cfg;
          if (TREE_CODE (lhs) == SSA_NAME)
            bitmap_clear_bit (inserted_exprs, SSA_NAME_VERSION (lhs));
          release_defs (stmt);
--- 4541,4550 ----
          gsi = gsi_for_stmt (stmt);
          unlink_stmt_vdef (stmt);
          gsi_remove (&gsi, true);
!         /* ???  gsi_remove doesn't tell us whether the stmt was
!            in EH tables and thus whether we need to purge EH edges.
!            Simply schedule the block for a cleanup.  */
!         bitmap_set_bit (need_eh_cleanup, bb->index);
          if (TREE_CODE (lhs) == SSA_NAME)
            bitmap_clear_bit (inserted_exprs, SSA_NAME_VERSION (lhs));
          release_defs (stmt);
Index: gcc/testsuite/g++.dg/torture/pr51903.C
===================================================================
*** gcc/testsuite/g++.dg/torture/pr51903.C      (revision 0)
--- gcc/testsuite/g++.dg/torture/pr51903.C      (revision 0)
***************
*** 0 ****
--- 1,9 ----
+ // { dg-do compile }
+ // { dg-options "-O2 -fnon-call-exceptions -fno-guess-branch-probability" }
+ 
+ #include <vector>
+ 
+ void foo ()
+ {
+   std::vector < std::vector< int > > (20000);
+ }

Reply via email to