https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82420
Bug ID: 82420 Summary: ICE with -malign-int and -m68000 Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: vvulpes0 at gmail dot com Target Milestone: --- Target: m68k-elf Created attachment 42297 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42297&action=edit test.c When compiling test.c with the -march=68000 and -malign-int flags, a segmentation fault occurs. My installed copy of 7.2.0 has limited debugging information, but another machine with 7.1.0 installed provides: $ m68k-elf-gcc -march=68000 -malign-int -c test.c test.c: In function 'f': test.c:3:4: internal compiler error: Segmentation fault a /= 3; ^~ 0x98c6df crash_signal ../../gcc-7.1.0/gcc/toplev.c:337 0x76072e assign_temp(tree_node*, int, int) ../../gcc-7.1.0/gcc/function.c:956 0x720e51 emit_push_insn(rtx_def*, machine_mode, tree_node*, rtx_def*, unsigned int, int, rtx_def*, int, rtx_def*, rtx_def*, int, rtx_def*, bool) ../../gcc-7.1.0/gcc/expr.c:4314 0x62f734 emit_library_call_value_1 ../../gcc-7.1.0/gcc/calls.c:4841 0x63452f emit_library_call_value(rtx_def*, rtx_def*, libcall_type, machine_mode, int, ...) ../../gcc-7.1.0/gcc/calls.c:5162 0x8be6ce expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*, int, optab_methods) ../../gcc-7.1.0/gcc/optabs.c:1758 0x8c0cfa sign_expand_binop(machine_mode, optab_tag, optab_tag, rtx_def*, rtx_def*, rtx_def*, int, optab_methods) ../../gcc-7.1.0/gcc/optabs.c:1888 0x712c98 expand_divmod(int, tree_code, machine_mode, rtx_def*, rtx_def*, rtx_def*, int) ../../gcc-7.1.0/gcc/expmed.c:5052 0x727084 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier) ../../gcc-7.1.0/gcc/expr.c:8841 0x63f85d expand_gimple_stmt_1 ../../gcc-7.1.0/gcc/cfgexpand.c:3676 0x63f85d expand_gimple_stmt ../../gcc-7.1.0/gcc/cfgexpand.c:3737 0x640cb5 expand_gimple_basic_block ../../gcc-7.1.0/gcc/cfgexpand.c:5744 0x64588e execute ../../gcc-7.1.0/gcc/cfgexpand.c:6357 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. This 7.1.0 was configured with: $ m68k-elf-gcc -v Using built-in specs. COLLECT_GCC=m68k-elf-gcc COLLECT_LTO_WRAPPER=/opt/toolchains/m68k/libexec/gcc/m68k-elf/7.1.0/lto-wrapper Target: m68k-elf Configured with: ../gcc-7.1.0/configure --target=m68k-elf --program-prefix=m68k-elf- --prefix=/opt/toolchains/m68k --with-local-prefix=/opt/toolchains/m68k --with-newlib --enable-languages=c,c++ --disabel-nls --disable-werror --enable-threads=single --disable-libssp --disable-libquadmath --with-cpu=68000 --with-arch=m68k Thread model: single gcc version 7.1.0 (GCC) The error persists if "-march=68000" is replaced by "-march=68010", but disappears for values of "68020" and above. This is presumably because the higher versions have (multiplication and) division instructions that operate on and produce wider types than the originals.