https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111279
Bug ID: 111279 Summary: ICE: Segmentation fault with m68k,SJLJ and -malign-int Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vincent.riviere at freesbee dot fr Target Milestone: --- m68k-elf-g++ causes "internal compiler error: Segmentation fault" when configured for m68k-elf, SJLJ exceptions, and compiling a specific program with -malign-int. $ cat >bug.cc <<EOF template<typename T> struct A { A() { } char buf[4]; }; template<typename T> struct B : public A<T> { B() { } }; template<typename T> struct C : public B<T> { C() throw() { } }; void f() { C<char> tmp; } EOF gcc was configured with: ~/sources/gcc/configure --target=m68k-elf --disable-nls --disable-multilib --enable-languages="c,c++" --disable-libstdc++-pch --disable-lto --enable-sjlj-exceptions $ /home/vincent/compil/gccelfsjlj.obj/gcc/cc1plus bug.cc -malign-int A<T>::A() B<T>::B() C<T>::C() void f() C<char> B<char> A<char> C<T>::C() [with T = char] C<T>::C() [with T = char] C<T>::C() [with T = char] B<T>::B() [with T = char] B<T>::B() [with T = char] B<T>::B() [with T = char] A<T>::A() [with T = char] A<T>::A() [with T = char] A<T>::A() [with T = char] Analyzing compilation unit Performing interprocedural optimizations <*free_lang_data> {heap 1068k} <visibility> {heap 1068k} <build_ssa_passes> {heap 1068k} <opt_local_passes> {heap 1348k} <remove_symbols> {heap 1348k} <targetclone> {heap 1348k} <free-fnsummary> {heap 1348k}Streaming LTO <whole-program> {heap 1348k} <fnsummary> {heap 1348k} <inline> {heap 1348k} <modref> {heap 1348k} <free-fnsummary> {heap 1348k} <single-use> {heap 1348k} <comdats> {heap 1348k}Assembling functions: void f() C<T>::C() [with T = char]during RTL pass: expand bug.cc: In constructor 'C<T>::C() [with T = char]': bug.cc:21:5: internal compiler error: Segmentation fault 21 | { } | ^ 0x1174ec3 crash_signal /home/vincent/sources/gcc/gcc/toplev.cc:314 0x7f7ca4a3c4af ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0xe08653 assign_temp(tree_node*, int, int) /home/vincent/sources/gcc/gcc/function.cc:976 0xdab01f emit_push_insn(rtx_def*, machine_mode, tree_node*, rtx_def*, unsigned int, int, rtx_def*, poly_int<1u, long>, rtx_def*, rtx_def*, int, rtx_def*, bool) /home/vincent/sources/gcc/gcc/expr.cc:4920 0xc5f915 emit_library_call_value_1(int, rtx_def*, rtx_def*, libcall_type, machine_mode, int, std::pair<rtx_def*, machine_mode>*) /home/vincent/sources/gcc/gcc/calls.cc:4585 0xd765bf emit_library_call(rtx_def*, libcall_type, machine_mode, rtx_def*, machine_mode) /home/vincent/sources/gcc/gcc/rtl.h:4343 0xd765bf sjlj_emit_function_enter /home/vincent/sources/gcc/gcc/except.cc:1212 0xd7b90d sjlj_build_landing_pads /home/vincent/sources/gcc/gcc/except.cc:1491 0xd7b90d finish_eh_generation() /home/vincent/sources/gcc/gcc/except.cc:1520 0xc7c1a6 execute /home/vincent/sources/gcc/gcc/cfgexpand.cc:6940 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. $ /home/vincent/compil/gccelfsjlj.obj/gcc/cc1plus bug.cc -malign-int A<T>::A() B<T>::B() C<T>::C() void f() C<char> B<char> A<char> C<T>::C() [with T = char] C<T>::C() [with T = char] C<T>::C() [with T = char] B<T>::B() [with T = char] B<T>::B() [with T = char] B<T>::B() [with T = char] A<T>::A() [with T = char] A<T>::A() [with T = char] A<T>::A() [with T = char] Analyzing compilation unit Performing interprocedural optimizations <*free_lang_data> {heap 1068k} <visibility> {heap 1068k} <build_ssa_passes> {heap 1068k} <opt_local_passes> {heap 1348k} <remove_symbols> {heap 1348k} <targetclone> {heap 1348k} <free-fnsummary> {heap 1348k}Streaming LTO <whole-program> {heap 1348k} <fnsummary> {heap 1348k} <inline> {heap 1348k} <modref> {heap 1348k} <free-fnsummary> {heap 1348k} <single-use> {heap 1348k} <comdats> {heap 1348k}Assembling functions: void f() C<T>::C() [with T = char]during RTL pass: expand bug.cc: In constructor 'C<T>::C() [with T = char]': bug.cc:21:5: internal compiler error: Segmentation fault 21 | { } | ^ 0x1174ec3 crash_signal /home/vincent/sources/gcc/gcc/toplev.cc:314 0x7f7ca4a3c4af ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0xe08653 assign_temp(tree_node*, int, int) /home/vincent/sources/gcc/gcc/function.cc:976 0xdab01f emit_push_insn(rtx_def*, machine_mode, tree_node*, rtx_def*, unsigned int, int, rtx_def*, poly_int<1u, long>, rtx_def*, rtx_def*, int, rtx_def*, bool) /home/vincent/sources/gcc/gcc/expr.cc:4920 0xc5f915 emit_library_call_value_1(int, rtx_def*, rtx_def*, libcall_type, machine_mode, int, std::pair<rtx_def*, machine_mode>*) /home/vincent/sources/gcc/gcc/calls.cc:4585 0xd765bf emit_library_call(rtx_def*, libcall_type, machine_mode, rtx_def*, machine_mode) /home/vincent/sources/gcc/gcc/rtl.h:4343 0xd765bf sjlj_emit_function_enter /home/vincent/sources/gcc/gcc/except.cc:1212 0xd7b90d sjlj_build_landing_pads /home/vincent/sources/gcc/gcc/except.cc:1491 0xd7b90d finish_eh_generation() /home/vincent/sources/gcc/gcc/except.cc:1520 0xc7c1a6 execute /home/vincent/sources/gcc/gcc/cfgexpand.cc:6940 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Tested with the current master branch (GCC 14), and also with GCC 13.2.0.