https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84704
Bug ID: 84704 Summary: internal compiler error: gimplification failed Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vegard.nossum at gmail dot com CC: webrown.cpp at gmail dot com Target Milestone: --- Input: int a[]{0}; void b() { a[({0;})] %= 0; } Output: $ xgcc -x c++ -S -g -O3 - <stdin>: In function 'void b()': <stdin>:4:12: warning: division by zero [-Wdiv-by-zero] gimplification failed: <statement_list 0x7f364780a8c0 type <void_type 0x7f36476b5f18 void VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f36476b5f18 pointer_to_this <pointer_type 0x7f36476bd0a8>> head (nil) tail (nil) stmts > <stdin>:4:12: internal compiler error: gimplification failed 0x2224a63 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:12393 0x223d389 gimplify_compound_lval /home/vegard/git/gcc/gcc/gimplify.c:2984 0x221c759 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11387 0x227970c gimplify_modify_expr /home/vegard/git/gcc/gcc/gimplify.c:5642 0x221e676 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11435 0x222b991 gimplify_stmt(tree_node**, gimple**) /home/vegard/git/gcc/gcc/gimplify.c:6658 0x221da9d gimplify_cleanup_point_expr /home/vegard/git/gcc/gcc/gimplify.c:6400 0x221da9d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11811 0x222b991 gimplify_stmt(tree_node**, gimple**) /home/vegard/git/gcc/gcc/gimplify.c:6658 0x221f1fb gimplify_statement_list /home/vegard/git/gcc/gcc/gimplify.c:1767 0x221f1fb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11863 0x222b991 gimplify_stmt(tree_node**, gimple**) /home/vegard/git/gcc/gcc/gimplify.c:6658 0x2234c59 gimplify_body(tree_node*, bool) /home/vegard/git/gcc/gcc/gimplify.c:12635 0x2236fb0 gimplify_function_tree(tree_node*) /home/vegard/git/gcc/gcc/gimplify.c:12800 0x19a3517 cgraph_node::analyze() /home/vegard/git/gcc/gcc/cgraphunit.c:670 0x19b65eb analyze_functions /home/vegard/git/gcc/gcc/cgraphunit.c:1131 0x19bb301 symbol_table::finalize_compilation_unit() /home/vegard/git/gcc/gcc/cgraphunit.c:2691 $ xgcc --version xgcc (GCC) 8.0.1 20180303 (experimental) Built from git 0d86c284d085d29782d862600a79aa1ff0ee0c47 (r258221). I am not sure if the code is invalid or not -- for sure div-by-0 is UB at run time, but I think it should be fine to compile this? Test case was minimised by C-Reduce.