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

            Bug ID: 122345
           Summary: On armv7hl, go immediately crashes on invocation
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: [email protected]
  Target Milestone: ---

When building GCC 15 (current release branch, e.g.
21e75aa0ad20f6ea05030455cef6e15e34ff0f8d) for host armv7hl, the resulting go
compiler immediately crashes with SIGBUS, even on "go version" invocation:

unexpected fault address 0xa4b4f7
fatal error: fault
[signal SIGBUS: bus error code=0x1 addr=0xa4b4f7 pc=0xf74a5140]

goroutine 1 [running, locked to thread]:
runtime.dopanic__m
        /gcc/libgo/go/runtime/panic.go:1204
runtime.fatalthrow
        /gcc/libgo/go/runtime/panic.go:1073
runtime.throw
        /gcc/libgo/go/runtime/panic.go:1044
runtime.sigpanic
        /gcc/libgo/go/runtime/signal_unix.go:714
os.statNolog
        /gcc/libgo/go/os/stat_unix.go:35
os.Stat
        /gcc/libgo/go/os/stat.go:13
os/exec.findExecutable
        /gcc/libgo/go/os/exec/lp_unix.go:21
os_1exec.LookPath
        /gcc/libgo/go/os/exec/lp_unix.go:41
internal_1execabs.LookPath
        /gcc/libgo/go/internal/execabs/execabs.go:35
cmd_1go_1internal_1work.cmd_1go_1internal_1work..init2
        /gcc/libgo/go/cmd/go/internal/work/gccgo.go:35
cmd_1go_1internal_1work..import
        /gcc/libgo/go/cmd/go/internal/work/gccgo.go:30
__go_init_main
        /gcc/gotools/../libgo/go/cmd/go/alldocs.go:3267
runtime.main
        /gcc/libgo/go/runtime/proc.go:263

The cause is a misaligned access.

In GCC 16 (current master branch, e.g.
eb717a8f4ea9f5eebb3d5add0ca4a33d74febd1a), this works.

I ran a bisect and the commit which fixes this crash is:

2edb50a310896da72710dba7724a3b4a541a1cbb is the first works commit
commit 2edb50a310896da72710dba7724a3b4a541a1cbb
Author: Alexandre Oliva <[email protected]>
Date:   Mon Jun 2 20:21:45 2025 -0300

    [lra] force reg update after spilling to memory [PR120424]

Reproducer as used for bisecting (copy-paste of distro gcc build options):

<path to gcc>/configure 'CFLAGS= -O2 -funwind-tables
-fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g'
'CXXFLAGS= -O2 -funwind-tables -fasynchronous-unwind-tables
-fstack-clash-protection -Werror=return-type -g' 'XCFLAGS= -O2 -funwind-tables
-fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g'
'TCFLAGS= -O2 -funwind-tables -fasynchronous-unwind-tables
-fstack-clash-protection -Werror=return-type -g' 'GDCFLAGS= -O2 -funwind-tables
-fasynchronous-unwind-tables -fstack-clash-protection -g' --prefix=/usr/local
--enable-languages=go --enable-host-shared --enable-checking=release
--disable-werror --with-gxx-include-dir=/usr/include/c++/15
--with-libstdcxx-zoneinfo=/usr/share/zoneinfo --enable-ssp --disable-libssp
--disable-libvtv --enable-cet=auto --disable-libcc1 --enable-plugin
--with-bugurl=https://bugs.opensuse.org/ '--with-pkgversion=SUSE Linux'
--with-slibdir=/lib --with-system-zlib --enable-libstdcxx-allocator=new
--disable-libstdcxx-pch --enable-version-specific-runtime-libs
--with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex
--enable-gnu-indirect-function --program-suffix=-15 --without-system-libunwind
--with-cpu=generic-armv7-a --with-float=hard --with-abi=aapcs-linux
--with-fpu=vfpv3-d16 --disable-sjlj-exceptions --enable-link-serialization
--build=armv7hl-suse-linux-gnueabi --host=armv7hl-suse-linux-gnueabi
--disable-bootstrap
make -j<...>
env LD_LIBRARY_PATH=$PWD/armv7hl-suse-linux-gnueabi/libgo/.libs/ gotools/go
version

Reply via email to