The attached testcase compiles fine with gcc 3.3, but ICEs with gcc 3.4 like so: deal.II/lac> c++ -c -O2 block_sparse_matrix.ii block_sparse_matrix.ii: In member function `void BlockSparseMatrix<number>::reinit(const BlockSparsityPattern&) [with number = double]': block_sparse_matrix.ii:34301: error: in basic block 35: block_sparse_matrix.ii:34301: error: flow control insn inside a basic block (call_insn 746 672 751 35 (call_placeholder 711 673 0 0 (call_insn 713 712 714 (parallel [ (set (reg:SI 2 $2) (call (mem:SI (reg:SI 321) [0 S4 A32]) (const_int 0 [0x0]))) (clobber (reg:SI 31 $31)) ]) -1 (nil) (nil) (expr_list (use (reg:SI 28 $28)) (expr_list (use (reg:SI 4 $4)) (nil))))) -1 (nil) (nil) (nil)) block_sparse_matrix.ii:34301: internal compiler error: in rtl_verify_flow_info_1, at cfgrtl.c:2053 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. Since this machine is just about too slow, I will not be able to provide reduced code for a while. If someone has an interest in beating me to it, please feel more than welcome! W.
Created attachment 6166 [details] preprocessed sources
I should note that I could trigger this ICE on three different files (two of them had the same kind of loop, the third one didn't; the common theme was the access to a previously assigned reference), so it doesn't seem to be a really rare thing. Who is the author of rtl_verify_flow_info_1? W.
rtl_verify_flow_info_1 came about with this patch but it was split out from rtl_verify_flow_info so it most likely not a bug in rtl_verify_flow_info_1 or rtl_verify_flow_info but a bug in the RTL optimizers, this is a verifier which verifiers if the RTL is wrong. Sun Jun 8 15:52:17 CEST 2003 Jan Hubicka <jh@suse.cz> * i386.md (subsi_3_zext, sse2_nandv2di3): Fix predicates. * i386.c (k8_avoid_jump_misspredicts): Fix debug output. * cfg.c (verify_flow_info): Move IL independent checks from cfgrtl here. (dump_bb): New based on old dump_bb in cfgrtl.c (debug_bb, debug_bb_n): Move the functions from cfgrtl.c here. * cfghooks.h (cfgh_verify_flow_info): Return status. * cfglayout.c (cfg_layout_finalize): Verify CFG correctness. * cfgrtl.c (debug_bb, debug_bb_n): Move to cfg.c (dump_bb): Remove generic parts. (rtl_verify_flow_info_1): Break out from rtl_verify_flow_info. (rtl_verify_flow_info): Only check things dependeing on linearized RTL.
Jan, does this ICE trigger something with you? W.
Here is a small testcase: -------------------------- struct S { S (); void reinit (); }; struct P { P & operator= (S *); S * operator -> () const; }; class X { void reinit (); P p; }; void X::reinit () { p = new S(); p->reinit (); } ----------------------------- bangerth/tmp> /home/staff/bangerth/bin/sgi/gcc-3.4.0/bin/c++ -O2 -c x.cc x.cc: In member function `void X::reinit()': x.cc:20: error: in basic block 0: x.cc:20: error: flow control insn inside a basic block (call_insn 86 6 90 0 (call_placeholder 51 13 0 0 (call_insn 53 52 54 (parallel [ (set (reg:SI 2 $2) (call (mem:SI (reg:SI 193) [0 S4 A32]) (const_int 0 [0x0]))) (clobber (reg:SI 31 $31)) ]) -1 (nil) (nil) (expr_list (use (reg:SI 28 $28)) (expr_list (use (reg:SI 4 $4)) (nil))))) -1 (nil) (nil) (nil)) x.cc:20: internal compiler error: in rtl_verify_flow_info_1, at cfgrtl.c:2053 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. bangerth/tmp> /home/staff/bangerth/bin/sgi/gcc-3.4.0/bin/c++ -v Reading specs from /home/staff/bangerth/bin/sgi/gcc-3.4.0/lib/gcc/mips-sgi-irix6.5/3.4.0/specs Configured with: ../gcc-3.4.0/configure --prefix=/home/staff/bangerth/bin/sgi/gcc-3.4.0 --enable-languages=c,c++,f77 --enable-checking Thread model: single gcc version 3.4.0 W.
Uh, this goes even smaller: ---------------------- struct S { S (); void foo (); }; struct P { P (S *); S s; }; void bar () { P p = new S(); p.s.foo (); } ---------------------------- bangerth/tmp> /home/staff/bangerth/bin/sgi/gcc-3.4.0/bin/c++ -O2 -c x.cc x.cc: In function `void bar()': x.cc:14: error: in basic block 0: x.cc:14: error: flow control insn inside a basic block (call_insn 85 104 98 0 (call_placeholder 50 12 0 0 (call_insn 52 51 53 (parallel [ (set (reg:SI 2 $2) (call (mem:SI (reg:SI 194) [0 S4 A32]) (const_int 0 [0x0]))) (clobber (reg:SI 31 $31)) ]) -1 (nil) (nil) (expr_list (use (reg:SI 28 $28)) (expr_list (use (reg:SI 4 $4)) (nil))))) -1 (nil) (nil) (nil)) x.cc:14: internal compiler error: in rtl_verify_flow_info_1, at cfgrtl.c:2053 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. W.
Confirmed (example in comment #6).
Been looking at this a little today. It seems to be specific to sibling calls (there's no problem if you use -fno-optimize-sibling-calls) and probably depends on how aggressively the backend tries to use them. MIPS is very aggressive ;) Taking the reduced example: void bar () { P p = new S(); p.s.foo (); } the first statement ends up in a call_placeholder. The call inside the placeholder can throw, so it (correctly?) satisfies control_flow_insn_p. It is initially placed in its own basic block. However, reachable_handlers returns an empty list for call_placeholders, so there are no EH edges from this block. The only edge is a fallthru to the second block. This convinces try_optimize_cfg that the blocks can be merged by merge_blocks_move(). I'm not sure when I'll next have time to look at this, but maybe the above will be enough to trigger an Aha!
Think I finally have a handle on this. Testing a patch now.
Patch posted here: http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01601.html (Mark, this is a somewhat target-independent 3.4.0 ICE-on-valid regression.)
Subject: Re: [3.4 regression] ICE in rtl_verify_flow_info_1 rsandifo at gcc dot gnu dot org wrote: > ------- Additional Comments From rsandifo at gcc dot gnu dot org 2004-06-20 11:00 ------- > Patch posted here: > > http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01601.html > > (Mark, this is a somewhat target-independent 3.4.0 ICE-on-valid regression.) This is OK for 3.4.1; please check in ASAP. Thanks,
Subject: Bug 15159 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: rsandifo@gcc.gnu.org 2004-06-21 06:30:18 Modified files: gcc : ChangeLog tree.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/opt: placeholder1.C Log message: PR rtl-optimization/15159 * tree.c (unsafe_for_reeval): Return 2 for TRY_CATCH_EXPRs. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.515&r2=2.2326.2.516 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.342.2.3&r2=1.342.2.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.211&r2=1.3389.2.212 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/placeholder1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Patch applied to 3.4 branch. Not a problem on mainline: see gcc-patches link.