https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70267
Bug ID: 70267 Summary: ICE on valid code at -O1 and above on x86_64-linux-gnu in propagate_necessity, at tree-ssa-dce.c:924 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following causes an ICE when compiled with the current GCC trunk at -O1 and above on x86_64-linux-gnu in both 32-bit and 64-bit modes. It seems to also affect all GCC versions since at least 4.6.x. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 6.0.0 20160317 (experimental) [trunk revision 234278] (GCC) $ $ g++-trunk -w -c -O0 small.cpp $ $ g++-trunk -w -c -O1 small.cpp small.cpp: In function ‘void Bar4()’: small.cpp:35:1: internal compiler error: in propagate_necessity, at tree-ssa-dce.c:924 } ^ 0xe72be3 propagate_necessity ../../gcc-source-trunk/gcc/tree-ssa-dce.c:924 0xe730ba perform_tree_ssa_dce ../../gcc-source-trunk/gcc/tree-ssa-dce.c:1599 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ ----------------------------------------------------- extern "Java" { typedef __java_int jint; namespace java { namespace lang { class Class; class Object; class Throwable {}; class Foo; } } } typedef struct java::lang::Object * jobject; typedef struct java::lang::Throwable * jthrowable; typedef class java::lang::Class * jclass; using java::lang::Foo; class Foo: public java::lang::Throwable { public:static::java::lang::Class class$; }; extern "C" Foo _Jv_AllocObject (jclass) __attribute__ ((__malloc__)); extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__)); void Bar4 (void) { Foo * f = new java::lang::Foo; throw (f); }