Bug 45314

Summary: [4.5 Regression] ICE: error: in remove_unreachable_handlers, at tree-sh.c:3294 with -O2 -floop-interchange
Product: gcc Reporter: bero
Component: tree-optimizationAssignee: Sebastian Pop <spop>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, jakub, spop
Priority: P2 Keywords: ice-on-valid-code
Version: 4.5.1   
Target Milestone: 4.5.2   
Host: i586-pc-linux-gnu Target: i586-pc-linux-gnu
Build: i586-pc-linux-gnu Known to work: 4.4.4, 4.6.0
Known to fail: 4.5.1 Last reconfirmed: 2010-08-18 09:16:16
Attachments: Preprocessed source
(fairly stupid) Workaround
0001-Fix-PR45314-backport-revision-163123.patch

Description bero 2010-08-17 22:24:41 UTC
i586-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I../..  -I../../librender -I../../libcore -I../../libcore/asobj -I../../libcore/asobj/flash -I../../libcore/swf -I../../libcore/abc -I../../libcore/parser -I../../libbase -I../../libmedia -I../../libsound -I../../libltdl -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include    -pthread  -D__STDC_CONSTANT_MACROS -I/usr/include -O2 -floop-interchange -c -o VM.lo VM.cpp
VM.cpp: In member function 'gnash::VM::RNG& gnash::VM::randomNumberGenerator() const':
VM.cpp:126:1: internal compiler error: in remove_unreachable_handlers, at tree-eh.c:3294
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 bero 2010-08-17 22:27:14 UTC
Created attachment 21508 [details]
Preprocessed source
Comment 2 Richard Biener 2010-08-18 09:16:16 UTC
With 4.5.1 I get (checking enabled)

VM.cpp: In member function 'gnash::VM::RNG& gnash::VM::randomNumberGenerator() const':
VM.cpp:126:1: error: statement marked for throw in middle of block
# .MEM_19 = VDEF <.MEM_18>
D.294844_12 = OBJ_TYPE_REF(D.294843_10;D.294841_8->0) (D.294841_8);

VM.cpp:126:1: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

and with trunk I get

VM.cpp: In member function 'gnash::VM::RNG& gnash::VM::randomNumberGenerator() const':
VM.cpp:126:1: internal compiler error: in create_linear_expr_from_tree, at graphite-sese-to-poly.c:1207
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

4.4.4 works.
Comment 3 bero 2010-08-31 18:48:51 UTC
Created attachment 21611 [details]
(fairly stupid) Workaround

Attaching workaround for people coming across this bug report when googling the error message.
Comment 4 Jakub Jelinek 2010-11-05 12:28:58 UTC
Can't reproduce with current trunk,
./cc1plus -m32 -O2 pr45314.ii -quiet -floop-interchange
is fine.
Comment 5 bero 2010-11-05 15:30:20 UTC
Still happens on current 4.5 branch
Comment 6 H.J. Lu 2010-11-05 16:26:44 UTC
On trunk, it was fixed by revision 163123:

http://gcc.gnu.org/ml/gcc-cvs/2010-08/msg00334.html
Comment 7 sebpop@gmail.com 2010-11-05 16:51:22 UTC
On Fri, Nov 5, 2010 at 11:26, hjl.tools at gmail dot com
<gcc-bugzilla@gcc.gnu.org> wrote:
> On trunk, it was fixed by revision 163123:
>
> http://gcc.gnu.org/ml/gcc-cvs/2010-08/msg00334.html
>

Thanks HJ for reducing this.
I looked at this change and it looks simple enough to backport it to 4.5.
Comment 8 Sebastian Pop 2010-11-05 17:16:48 UTC
Mine.
Comment 9 H.J. Lu 2010-11-05 18:04:46 UTC
Created attachment 22296 [details]
0001-Fix-PR45314-backport-revision-163123.patch

Just for the record, this is introduced by revision 155739:

http://gcc.gnu.org/ml/gcc-cvs/2010-01/msg00200.html
Comment 10 sebpop@gmail.com 2010-11-05 18:17:01 UTC
Here is the backported patch that fixes the ICE.
I will further test this and will post to gcc-patches.

Sebastian
Comment 11 Sebastian Pop 2010-11-09 19:15:19 UTC
The patch fixing this has been committed with the wrong PR number on: 

Author: spop
Date: Tue Nov  9 19:08:57 2010
New Revision: 166506

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166506
Log:
Fix PR45314: backport revision 163123.

2010-11-09  Sebastian Pop  <sebastian.pop@amd.com>

   PR tree-optimization/45902
   Backport of revision 163132.
   * graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Always insert out
   of SSA copies on edges except for loop->latch.

Modified:
   branches/gcc-4_5-branch/gcc/ChangeLog
   branches/gcc-4_5-branch/gcc/graphite-sese-to-poly.c
Comment 12 Sebastian Pop 2010-11-09 19:15:39 UTC
Author: spop
Date: Tue Nov  9 19:15:36 2010
New Revision: 166507

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166507
Log:
Fix Changelog entry.

2010-11-09  Sebastian Pop  <sebastian.pop@amd.com>

   PR tree-optimization/45314
   Backport of revision 163132.
   * graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Always insert out
   of SSA copies on edges except for loop->latch.

Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
Comment 13 Sebastian Pop 2010-11-09 19:16:37 UTC
Fixed.