A combination of options can yield the error: internal compiler error: in remove_unreachable_handlers, at tree-eh.c To produce the error, g++ is invoked thus: g++ -c -pipe --trapv --non-call-exceptions --stack-check -O2 Aside from -pipe and -O2, which can be further decomposed, the options are the minimal set to produce the error in this case. Build from URL: svn://gcc.gnu.org/svn/gcc/branches/gcc-4_5-branch Repository Root: svn://gcc.gnu.org/svn/gcc Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4 Revision: 160774 unset LDFLAGS export CFLAGS=-pipe export CXXFLAGS=-pipe configure --enable-languages=c++ make bootstrap-lean See attachment for source code of test case. Taken from geany/scintilla.
Created attachment 20917 [details] Instance of source code which causes crash. from geany/scintilla
CallTip.cxx: In member function 'void CallTip::DrawChunk(Surface*, int&, const char*, int, int, int, PRectangle, bool, bool)': CallTip.cxx:87:6: error: control flow in the middle of basic block 64 CallTip.cxx:87:6: internal compiler error: verify_flow_info failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Reducing.
class CallTip { int tabSize; int DrawChunk(int &x); int NextTabPos(int x); }; int CallTip::NextTabPos(int x) { if (tabSize > 0) { x -= 5; x = (x + tabSize) / tabSize; } } int CallTip::DrawChunk(int &x) { const int numEnds = 10; int ends[numEnds + 2]; return NextTabPos(x); }
Reduced even further: int DrawChunk(int *tabSize, int x) { const int numEnds = 10; int ends[numEnds + 2]; if (*tabSize > 0) { x -= 5; x = (x + *tabSize) / *tabSize; } } --- CUT --- Compile with -O2 -fstack-check -fnon-call-exceptions -ftrapv -fexceptions (the last option is needed for C front-end). As far as I can tell the reassoication pass causes the ICE.
(gdb) p debug_bb_n(6) ;; basic block 6, loop depth 0, count 0 ;; prev block 5, next block 7 ;; pred: 5 [100.0%] (fallthru,exec) ;; succ: 9 (eh,exec) 7 [100.0%] (fallthru,exec) <bb 6>: D.1986_12 = D.1986_7; x_10 = D.1986_7 + x_9(D); D.1989_14 = x_10 + -5; Yep, the assignment to x_10 can trap which means it can throw an exception which reassociation needs to be corrected/turned off for non call exceptions with trapv turned on.
GCC 4.5.1 is being released, adjusting target milestone.
Can't reproduce it on current trunk. Looking at it on the branch.
> Can't reproduce it on current trunk. Looking at it on the branch. Try -fstack-check=generic on the trunk.
The fix for PR45232 fixed it on the trunk.
Author: rguenth Date: Tue Nov 16 13:53:50 2010 New Revision: 166796 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166796 Log: 2010-11-16 Richard Guenther <rguenther@suse.de> PR tree-optimization/44545 * tree-ssa-reassoc.c (linearize_expr_tree): Possibly throwing statements are not reassociatable. (reassociate_bb): Likewise. * gcc.dg/pr44545.c: New testcase. Added: branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/pr44545.c Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/testsuite/ChangeLog branches/gcc-4_5-branch/gcc/tree-ssa-reassoc.c
Author: rguenth Date: Tue Nov 16 14:15:55 2010 New Revision: 166799 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166799 Log: 2010-11-16 Richard Guenther <rguenther@suse.de> PR tree-optimization/44545 * tree-ssa-reassoc.c (linearize_expr_tree): Possibly throwing statements are not reassociatable. (reassociate_bb): Likewise. * gcc.dg/pr44545.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/pr44545.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-reassoc.c
Fixed.