http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58345
Bug ID: 58345 Summary: ICE with SIGFPE at -O1 on x86_64-linux-gnu (affecting trunk and 4.8) Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu The following code causes an ICE when compiled with the current gcc trunk and 4.8 at -O1 only on x86_64-linux (both 32-bit and 64-bit modes). This is a regression from 4.7.x. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-trunk/configure --enable-languages=c,c++,objc,obj-c++,fortran,lto --with-gmp=/usr/local/gcc-trunk --with-mpfr=/usr/local/gcc-trunk --with-mpc=/usr/local/gcc-trunk --with-cloog=/usr/local/gcc-trunk --prefix=/usr/local/gcc-trunk Thread model: posix gcc version 4.9.0 20130906 (experimental) [trunk revision 202308] (GCC) $ gcc-trunk -O0 -c small.c $ gcc-trunk -O2 -c small.c $ gcc-trunk -O3 -c small.c $ gcc-trunk -Os -c small.c $ gcc-4.7 -O1 -c small.c $ gcc-trunk -O1 -c small.c small.c: In function ‘foo’: small.c:7:6: internal compiler error: Floating point exception void foo () ^ 0x924b2f crash_signal ../../gcc-trunk/gcc/toplev.c:335 0x77ecd3 fold_array_ctor_reference ../../gcc-trunk/gcc/gimple-fold.c:2816 0x77ecd3 fold_ctor_reference ../../gcc-trunk/gcc/gimple-fold.c:2964 0x7827d2 fold_const_aggregate_ref_1(tree_node*, tree_node* (*)(tree_node*)) ../../gcc-trunk/gcc/gimple-fold.c:3066 0x78443b fold_const_aggregate_ref ../../gcc-trunk/gcc/gimple-fold.c:3088 0x78443b maybe_fold_reference ../../gcc-trunk/gcc/gimple-fold.c:272 0x784df6 gimple_fold_call ../../gcc-trunk/gcc/gimple-fold.c:1091 0x784df6 fold_stmt_1 ../../gcc-trunk/gcc/gimple-fold.c:1200 0x9763c9 fold_marked_statements ../../gcc-trunk/gcc/tree-inline.c:4380 0x980ff6 tree_function_versioning(tree_node*, tree_node*, vec<ipa_replace_map*, va_gc, vl_embed>*, bool, bitmap_head_def*, bool, bitmap_head_def*, basic_block_def*) ../../gcc-trunk/gcc/tree-inline.c:5354 0xd85e62 save_inline_function_body ../../gcc-trunk/gcc/ipa-inline-transform.c:368 0xd85e62 inline_transform(cgraph_node*) ../../gcc-trunk/gcc/ipa-inline-transform.c:425 0x880e6f execute_one_ipa_transform_pass ../../gcc-trunk/gcc/passes.c:2039 0x880e6f execute_all_ipa_transforms() ../../gcc-trunk/gcc/passes.c:2079 0x636160 expand_function ../../gcc-trunk/gcc/cgraphunit.c:1702 0x63809d expand_all_functions ../../gcc-trunk/gcc/cgraphunit.c:1814 0x63809d compile() ../../gcc-trunk/gcc/cgraphunit.c:2151 0x638729 finalize_compilation_unit() ../../gcc-trunk/gcc/cgraphunit.c:2228 0x516813 c_write_global_declarations() ../../gcc-trunk/gcc/c/c-decl.c:10125 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. $ gcc-4.8 -O1 -c small.c small.c: In function ‘foo’: small.c:7:6: internal compiler error: Floating point exception void foo () ^ 0x7b925f crash_signal ../../gcc-4.8.1/gcc/toplev.c:332 0x678f55 fold_array_ctor_reference ../../gcc-4.8.1/gcc/gimple-fold.c:2819 0x678f55 fold_ctor_reference ../../gcc-4.8.1/gcc/gimple-fold.c:2967 0x67bd77 fold_const_aggregate_ref_1(tree_node*, tree_node* (*)(tree_node*)) ../../gcc-4.8.1/gcc/gimple-fold.c:3069 0x67cd43 fold_const_aggregate_ref ../../gcc-4.8.1/gcc/gimple-fold.c:3091 0x67cd43 maybe_fold_reference ../../gcc-4.8.1/gcc/gimple-fold.c:277 0x67d434 gimple_fold_call ../../gcc-4.8.1/gcc/gimple-fold.c:1096 0x67d434 fold_stmt_1 ../../gcc-4.8.1/gcc/gimple-fold.c:1202 0x7ee097 fold_marked_statements ../../gcc-4.8.1/gcc/tree-inline.c:4237 0x7f42b6 tree_function_versioning(tree_node*, tree_node*, vec<ipa_replace_map*, va_gc, vl_embed>*, bool, bitmap_head_def*, bool, bitmap_head_def*, basic_block_def*) ../../gcc-4.8.1/gcc/tree-inline.c:5299 0xb3d7c2 save_inline_function_body ../../gcc-4.8.1/gcc/ipa-inline-transform.c:351 0xb3d7c2 inline_transform(cgraph_node*) ../../gcc-4.8.1/gcc/ipa-inline-transform.c:408 0x7319c7 execute_one_ipa_transform_pass ../../gcc-4.8.1/gcc/passes.c:2172 0x7319c7 execute_all_ipa_transforms() ../../gcc-4.8.1/gcc/passes.c:2208 0x59f876 expand_function ../../gcc-4.8.1/gcc/cgraphunit.c:1633 0x5a0d06 expand_all_functions ../../gcc-4.8.1/gcc/cgraphunit.c:1744 0x5a0d06 compile() ../../gcc-4.8.1/gcc/cgraphunit.c:2042 0x5a10b9 finalize_compilation_unit() ../../gcc-4.8.1/gcc/cgraphunit.c:2119 0x4e0453 c_write_global_declarations() ../../gcc-4.8.1/gcc/c/c-decl.c:10118 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. $ --------------------------------------- struct U {}; static struct U a[1] = {}; extern void bar(struct U); void foo () { bar (a[0]); } int main () { foo(); return 0; }