This code was distilled from debian source pose_3.5-7.dsc (The Palm OS Emulator).
The bug manifests after a number of "warning: overflow in implicit constant conversion" and then "internal compiler error: in tree_low_cst, at tree.c:3843". There must be at least 5 warnings or the ICE does not appear. This Debian sid on an AMD64. g++-3.4 (gcc version 3.4.5 20050706 (prerelease) (Debian 3.4.4-5)) does NOT exhibit this bug. command line: $ g++-4.0 -c testcase.cpp output: testcase.cpp: In function 'int main(value_type)': testcase.cpp:12: warning: overflow in implicit constant conversion testcase.cpp:13: warning: overflow in implicit constant conversion testcase.cpp:14: warning: overflow in implicit constant conversion testcase.cpp:15: warning: overflow in implicit constant conversion testcase.cpp:16: warning: overflow in implicit constant conversion testcase.cpp:10: internal compiler error: in tree_low_cst, at tree.c:3843 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.0/README.Bugs>. --testcase.cpp-- typedef int value_type; const value_type b = 0x80000000; const value_type e1 = b + 1; const value_type e2 = b + 2; const value_type e3 = b + 3; const value_type e4 = b + 4; const value_type e5 = b + 5; int main (value_type error) { switch (error) { case e1: return 0; case e2: return 0; case e3: return 0; case e4: return 0; case e5: return 0; } } --testcase.cpp-- gcc -v: Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls --without-included-gettext --enable-threads=posix --program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk-default --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --enable-checking=release x86_64-linux-gnu Thread model: posix gcc version 4.0.1 (Debian 4.0.1-2) -- Summary: [ICE] in tree_low_cst, at tree.c:3843 Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: emailwastefilter-bugzillagccorg at yahoo dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22551