http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51592
Bug #: 51592
Summary: ICE with -fnon-call-exceptions
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: [email protected]
ReportedBy: [email protected]
Compile this C program with -O -fexceptions -fnon-call-exceptions:
extern void f2 () __attribute__ ((noreturn));
void
f1 ()
{
unsigned char a[8];
unsigned int i;
for (i = 0; i < 8; i++)
{
if (i > 8)
f2 ();
a[i] = i <= 8;
}
}
With current mainline I get an ICE:
foo.c: In function ‘f1’:
foo.c:3:1: error: statement marked for throw, but doesn’t
# .MEM_17 = VDEF <.MEM_8(D)>
a[0] = D.1714_10;
foo.c:3:1: internal compiler error: verify_gimple failed
The basic problem is that the compiler thinks that a[i] can trap, and because
we are using -fnon-call-exceptions, it sets up an exception region for it.
When the loop is unrolled, the statement changes from a[i] to a[0]. The
compiler knows that a[0] can not trap, but the statement is still in the
exception region.