https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82875
Bug ID: 82875 Summary: ICE at -Os on valid code on x86_64-linux-gnu: in find_widening_optab_handler_and_mode, at optabs-query.c:414 Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: helloqirun at gmail dot com Target Milestone: --- It happens at -Os and in 32-bit mode only. $ 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/8.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 8.0.0 20171106 (experimental) [trunk revision 254453] (GCC) $ gcc-trunk -m32 -Os abc.c during RTL pass: expand abc.c: In function ‘fn1’: abc.c:15:25: internal compiler error: in find_widening_optab_handler_and_mode, at optabs-query.c:414 d ? (a %= c) * (e *= a ? f : b) : 0; ^~ 0xb9b215 find_widening_optab_handler_and_mode(optab_tag, machine_mode, machine_mode, machine_mode*) ../../gcc/gcc/optabs-query.c:414 0xb8e9da expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*, int, optab_methods) ../../gcc/gcc/optabs.c:1152 0xb91fc0 expand_doubleword_mult ../../gcc/gcc/optabs.c:865 0xb8fbc8 expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*, int, optab_methods) ../../gcc/gcc/optabs.c:1705 0x966155 expand_mult(machine_mode, rtx_def*, rtx_def*, rtx_def*, int) ../../gcc/gcc/expmed.c:3427 0x98b314 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier) ../../gcc/gcc/expr.c:8802 0x865371 expand_gimple_stmt_1 ../../gcc/gcc/cfgexpand.c:3712 0x865371 expand_gimple_stmt ../../gcc/gcc/cfgexpand.c:3773 0x8669d8 expand_gimple_basic_block ../../gcc/gcc/cfgexpand.c:5774 0x86b756 execute ../../gcc/gcc/cfgexpand.c:6375 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. $ cat abc.c char a; unsigned b; long c, d; long long e; void fn1() { short f = a = 6; for (; 4 <= 3;) for (; a <= 7;) { for (;;) ; l1: for (; c <= 73;) ; e = 20; d ? (a %= c) * (e *= a ? f : b) : 0; } goto l1; }