https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120070

            Bug ID: 120070
           Summary: m68k-linux-gnu-gcc -Os ICE segfault compiling
                    xfs_trans_ail.c
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ats-gccbugs at offog dot org
  Target Milestone: ---

Created attachment 61275
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61275&action=edit
Minimised example

The attached example was minimised using cvise from Linux 6.14.5's
fs/xfs/xfs_trans_ail.c. It causes a segfault when being compiled for
m68k-linux-gnu with -Os, both using a cross-compiler from x86-64 and natively
on m68k.

$ m68k-linux-gnu-gcc -v -Os -c in3.c
Using built-in specs.
COLLECT_GCC=m68k-linux-gnu-gcc
Target: m68k-linux-gnu
Configured with: /src/devel/gcc-m68k/work/gcc-15.1.0/configure --prefix=/gar
--sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/com
--target=m68k-linux-gnu --with-sysroot=/cross/linux-m68k --disable-libssp
--disable-libcc1 --disable-multilib --with-system-zlib
--enable-languages=ada,c,c++,fortran,lto,objc,obj-c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.1.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-Os' '-c' '-mcpu=68020'
 /gar/packages/gcc-m68k-15.1.0/bin/../libexec/gcc/m68k-linux-gnu/15.1.0/cc1
-quiet -v -iprefix
/gar/packages/gcc-m68k-15.1.0/bin/../lib/gcc/m68k-linux-gnu/15.1.0/ in3.c
-quiet -dumpbase in3.c -dumpbase-ext .c -mcpu=68020 -Os -version -o
/tmp/ccYE2g4p.s
GNU C23 (GCC) version 15.1.0 (m68k-linux-gnu)
        compiled by GNU C version 15.1.0, GMP version 6.3.0, MPFR version
4.2.2, MPC version 1.3.1, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory
"/gar/packages/gcc-m68k-15.1.0/bin/../lib/gcc/../../lib/gcc/m68k-linux-gnu/15.1.0/include"
ignoring nonexistent directory "/cross/linux-m68k/usr/local/include"
ignoring duplicate directory
"/gar/packages/gcc-m68k-15.1.0/bin/../lib/gcc/../../lib/gcc/m68k-linux-gnu/15.1.0/include-fixed"
ignoring duplicate directory
"/gar/packages/gcc-m68k-15.1.0/bin/../lib/gcc/../../lib/gcc/m68k-linux-gnu/15.1.0/../../../../m68k-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /gar/packages/gcc-m68k-15.1.0/bin/../lib/gcc/m68k-linux-gnu/15.1.0/include

/gar/packages/gcc-m68k-15.1.0/bin/../lib/gcc/m68k-linux-gnu/15.1.0/include-fixed

/gar/packages/gcc-m68k-15.1.0/bin/../lib/gcc/m68k-linux-gnu/15.1.0/../../../../m68k-linux-gnu/include
 /cross/linux-m68k/usr/include
End of search list.
Compiler executable checksum: 934e09e57f147491320a4df4b8da0612
during RTL pass: reload
in3.c: In function ‘xfsaild’:
in3.c:32:1: internal compiler error: Segmentation fault
   32 | }
      | ^
0x7fb219ef977f ???
       
/src/sys/glibc/work/5b4c4617016d28569106549dff6f9fec73eed5ce/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7fb219ee3db4 __libc_start_call_main
        ../sysdeps/nptl/libc_start_call_main.h:58
0x7fb219ee3e66 __libc_start_main_impl
        ../csu/libc-start.c:360
0xcb6010 _start
        ../sysdeps/x86_64/start.S:115
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.

The backtrace there doesn't look very helpful, so here's one from gdb:

$ gdb --args
/gar/packages/gcc-m68k-15.1.0/bin/../libexec/gcc/m68k-linux-gnu/15.1.0/cc1
-quiet -v -iprefix
/gar/packages/gcc-m68k-15.1.0/bin/../lib/gcc/m68k-linux-gnu/15.1.0/ in3.c
-quiet -dumpbase in3.c -dumpbase-ext .c -mcpu=68020 -Os -version -o
/tmp/ccjA6b45.s
GNU gdb (GDB) 16.3
(gdb) run
[... same output as above ...]
Compiler executable checksum: 934e09e57f147491320a4df4b8da0612

Program received signal SIGSEGV, Segmentation fault.
0x0000000000f5ff7d in df_install_refs(basic_block_def*, vec<df_ref_d*, va_heap,
vl_ptr> const*, df_reg_info**, df_ref_info*, bool) ()
(gdb) where
#0  0x0000000000f5ff7d in df_install_refs(basic_block_def*, vec<df_ref_d*,
va_heap, vl_ptr> const*, df_reg_info**, df_ref_info*, bool) ()
#1  0x0000000000f6014f in df_refs_add_to_chains(df_collection_rec*,
basic_block_def*, rtx_insn*, unsigned int) ()
#2  0x0000000000f62064 in df_bb_refs_record(int, bool) ()
#3  0x0000000000f5bb21 in df_scan_blocks() ()
#4  0x0000000001284179 in do_reload() ()
#5  0x0000000001284447 in (anonymous
namespace)::pass_reload::execute(function*) ()
#6  0x00000000013e4563 in execute_one_pass(opt_pass*) ()
#7  0x00000000013e492e in execute_pass_list_1(opt_pass*) ()
#8  0x00000000013e495f in execute_pass_list_1(opt_pass*) ()
#9  0x00000000013e49b8 in execute_pass_list(function*, opt_pass*) ()
#10 0x0000000000f2cebe in cgraph_node::expand() ()
#11 0x0000000000f2d51d in expand_all_functions() ()
#12 0x0000000000f2dfb4 in symbol_table::compile() ()
#13 0x0000000000f2e400 in symbol_table::finalize_compilation_unit() ()
#14 0x00000000015358ed in compile_file() ()
#15 0x0000000001538c17 in do_compile() ()
#16 0x000000000153905f in toplev::main(int, char**) ()
#17 0x0000000002531184 in main ()

Reply via email to