https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85156
Bug ID: 85156 Summary: -O1 -g internal compiler error: gimplification failed Product: gcc Version: 8.0.1 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vegard.nossum at oracle dot com CC: webrown.cpp at gmail dot com Target Milestone: --- Input (valid code AFAICT): int a, b; int f() { return __builtin_expect(a ? b != 0 : 0, ({ 1; })); } Output: $ cc1plus -O1 -g int f() Analyzing compilation unit gimplification failed: <statement_list 0x7f0773a108c0 type <void_type 0x7f07738bbf18 void VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f07738bbf18 pointer_to_this <pointer_type 0x7f07738c30a8>> head (nil) tail (nil) stmts > output/gimplification-failed.cc:5:26: internal compiler error: gimplification failed return __builtin_expect(a ? b != 0 : 0, ({ 1; })); ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ 0x222d153 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:12395 0x22252a5 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11377 0x22584ec gimplify_expr /home/vegard/git/gcc/gcc/gimplify.c:12432 0x225de68 gimplify_arg(tree_node**, gimple**, unsigned int, bool) /home/vegard/git/gcc/gcc/gimplify.c:3179 0x225fe07 gimplify_call_expr /home/vegard/git/gcc/gcc/gimplify.c:3385 0x22264bf gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11408 0x2224be2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:12161 0x227b353 gimplify_cond_expr /home/vegard/git/gcc/gcc/gimplify.c:4066 0x222753a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11393 0x2234081 gimplify_stmt(tree_node**, gimple**) /home/vegard/git/gcc/gcc/gimplify.c:6660 0x22278eb gimplify_statement_list /home/vegard/git/gcc/gcc/gimplify.c:1767 0x22278eb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11865 0x2234081 gimplify_stmt(tree_node**, gimple**) /home/vegard/git/gcc/gcc/gimplify.c:6660 0x227c1bc gimplify_cond_expr /home/vegard/git/gcc/gcc/gimplify.c:4054 0x222753a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11393 0x2234081 gimplify_stmt(tree_node**, gimple**) /home/vegard/git/gcc/gcc/gimplify.c:6660 0x227a9ce gimplify_cond_expr /home/vegard/git/gcc/gcc/gimplify.c:4025 0x222753a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11393 0x2281d9c gimplify_modify_expr /home/vegard/git/gcc/gcc/gimplify.c:5628 0x2226d66 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11437 Test case was minimised by C-Reduce, it seems both -O1 and -g are necessary for the ICE. Clang is fine with it, and 7.3.0 seems fine with it as well.