Created attachment 23986 [details] auto-reduced testcase $ gcc -Os -fopenmp -fexceptions -fno-tree-ccp -fno-tree-copy-prop testcase-min1.f90 ==12201== Invalid read of size 4 ==12201== at 0xBD4B3F: remap_eh_region_nr.isra.81 (tree-inline.c:1194) ==12201== by 0xBD8A59: remap_gimple_stmt (tree-inline.c:1444) ==12201== by 0xBD97EF: copy_cfg_body (tree-inline.c:1540) ==12201== by 0xBDB6B6: copy_body (tree-inline.c:2410) ==12201== by 0xBDE493: optimize_inline_calls (tree-inline.c:3928) ==12201== by 0xBB67A2: cgraph_early_inlining (ipa-inline.c:1642) ==12201== by 0x87F305: execute_one_pass (passes.c:1555) ==12201== by 0x87F5F4: execute_pass_list (passes.c:1610) ==12201== by 0x87E80B: do_per_function_toporder (passes.c:1141) ==12201== by 0x87FA95: execute_ipa_pass_list (passes.c:1927) ==12201== by 0xBAC6DC: cgraph_optimize (cgraphunit.c:1789) ==12201== by 0xBAC949: cgraph_finalize_compilation_unit (cgraphunit.c:1102) ==12201== by 0x836BFC: write_global_declarations (langhooks.c:303) ==12201== by 0x96CC99: toplev_main (toplev.c:591) ==12201== by 0x644AB6C: (below main) (in /lib64/libc-2.11.3.so) ==12201== Address 0x18 is not stack'd, malloc'd or (recently) free'd ==12201== testcase-min1.f90: In function 'main': testcase-min1.f90:8:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162219
Created attachment 24030 [details] gcc46-pr48611.patch While the bug is most probably elsewhere, I wonder why note_eh_region_may_contain_throw doesn't stop propagating on ERT_MUST_NOT_THROW regions. In my understanding no exception is ever propagated out of those regions, the program would be terminated instead, so I wonder why we should be trying to handle thrown exceptions in the outer regions. The patch makes the ICE go away, as we don't needlessly try to handle exceptions in the outer try {} finally {}.
Author: jakub Date: Wed Apr 20 18:18:16 2011 New Revision: 172783 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172783 Log: PR tree-optimization/48611 * tree-eh.c (note_eh_region_may_contain_throw): Don't propagate beyond ERT_MUST_NOT_THROW region. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-eh.c
Author: jakub Date: Wed Apr 20 18:19:47 2011 New Revision: 172786 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172786 Log: PR tree-optimization/48611 * tree-eh.c (note_eh_region_may_contain_throw): Don't propagate beyond ERT_MUST_NOT_THROW region. Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/tree-eh.c
Fixed.
Author: jakub Date: Tue May 10 06:08:18 2011 New Revision: 173607 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173607 Log: PR tree-optimization/48611 PR tree-optimization/48794 * tree-eh.c (remove_unreachable_handlers): Don't remove regions referenced from RESX or EH_DISPATCH arguments. * gfortran.dg/gomp/pr48611.f90: New test. * gfortran.dg/gomp/pr48794.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/gomp/pr48611.f90 trunk/gcc/testsuite/gfortran.dg/gomp/pr48794.f90 Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-eh.c
Author: jakub Date: Tue May 10 06:31:59 2011 New Revision: 173608 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173608 Log: PR tree-optimization/48611 PR tree-optimization/48794 * tree-eh.c (remove_unreachable_handlers): Don't remove regions referenced from RESX or EH_DISPATCH arguments. * gfortran.dg/gomp/pr48611.f90: New test. * gfortran.dg/gomp/pr48794.f90: New test. Added: branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/gomp/pr48611.f90 branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/gomp/pr48794.f90 Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/testsuite/ChangeLog branches/gcc-4_6-branch/gcc/tree-eh.c