https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69974
Bug ID: 69974 Summary: gcc ICE on invalid code on x86_64-linux-gnu in "create_tmp_from_val" Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: helloqirun at gmail dot com Target Milestone: --- The following invalid code causes an ICE when compiled with the current gcc trunk on x86_64-linux-gnu in both 32-bit and 64-bit modes. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 6.0.0 20160225 (experimental) [trunk revision 233714] (GCC) $ gcc-trunk abc.c abc.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token char var1 ); ^ abc.c: In function 'fn1': abc.c:5:13: warning: implicit declaration of function 'var1' [-Wimplicit-function-declaration] var3 &= var1 ( &var2 ^~~~ abc.c:5:5: error: expected ')' at end of input var3 &= var1 ( &var2 ^~~~ abc.c:5:5: error: expected declaration or statement at end of input abc.c: At top level: abc.c:2:11: error: storage size of 'var2' isn't known struct S1 var2; ^~~~ abc.c: In function 'fn1': abc.c:5:13: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.c:497 var3 &= var1 ( &var2 0xddd3b7 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.c:9688 0x8f61ef tree_class_check(tree_node*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.h:3129 0x8f61ef create_tmp_from_val ../../gcc/gcc/gimplify.c:497 0x8f61ef lookup_tmp_var ../../gcc/gcc/gimplify.c:533 0x8f61ef internal_get_tmp_var ../../gcc/gcc/gimplify.c:563 0x8fc462 get_initialized_tmp_var(tree_node*, gimple**, gimple**) ../../gcc/gcc/gimplify.c:600 0x8fc462 gimplify_save_expr ../../gcc/gcc/gimplify.c:4979 0x8fc462 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:10452 0x9015e6 gimplify_stmt(tree_node**, gimple**) ../../gcc/gcc/gimplify.c:5644 0x9021f1 gimplify_compound_expr ../../gcc/gcc/gimplify.c:4934 0x8fe64c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:10153 0x9015e6 gimplify_stmt(tree_node**, gimple**) ../../gcc/gcc/gimplify.c:5644 0x902825 gimplify_bind_expr ../../gcc/gcc/gimplify.c:1142 0x8fc8b2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:10363 0x9015e6 gimplify_stmt(tree_node**, gimple**) ../../gcc/gcc/gimplify.c:5644 0x903444 gimplify_body(tree_node*, bool) ../../gcc/gcc/gimplify.c:11295 0x903ad6 gimplify_function_tree(tree_node*) ../../gcc/gcc/gimplify.c:11451 0x786e27 cgraph_node::analyze() ../../gcc/gcc/cgraphunit.c:625 0x78a193 analyze_functions ../../gcc/gcc/cgraphunit.c:1086 0x78aed8 symbol_table::finalize_compilation_unit() ../../gcc/gcc/cgraphunit.c:2540 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. $ cat abc.c char var1 ); struct S1 var2; int var3; void fn1() { var3 &= var1 ( &var2