With gcc 4.1.2, this short code:
void f1(int);
void f2(int x)
{
if (x != -2147483647 - 1)
f1(-x);
}
causes GCC to segfault.
$ gcc/bin/gcc -c -O -ftree-vrp -ftrapv trapv-ice.c
trapv-ice.c: In function ‘f2’:
trapv-ice.c:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
--
Summary: ICE with -O -ftrapv -ftree-vrp on negation after
comparison to INT_MIN
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: truedfx at gentoo dot org
GCC host triplet: x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31940