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

            Bug ID: 125795
           Summary: Code generation broken with -funroll-loops when
                    targeting armv8-a.
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nick at appletonaudio dot com
  Target Milestone: ---

Created attachment 64740
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64740&action=edit
The .s file output of building a small test-case with -save-temps

I did some bisection using godbolt and found this issue started appearing
between version 13.4.0 and 14.1.0. I listed the affected version as 15.2.0
because that is what I am using. The code generation is fine when targeting
amd64 which is why I have listed the component as "target" but this is just my
best guess.

Thank you for all your great work and let me know if there is more information
needed.

---

* the exact version of GCC;
* the options given when GCC was configured/built;

Follows is the output from `gcc -v`

> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-linux-gnu/15/lto-wrapper
> OFFLOAD_TARGET_NAMES=nvptx-none
> OFFLOAD_TARGET_DEFAULT=1
> Target: aarch64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu 
> 15.2.0-16ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-15/README.Bugs 
> --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust,cobol,algol68 
> --prefix=/usr --with-gcc-major-version-only --program-suffix=-15 
> --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id 
> --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix 
> --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu 
> --enable-libstdcxx-debug --enable-libstdcxx-time=yes 
> --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace 
> --enable-gnu-unique-object --disable-libquadmath 
> --disable-libquadmath-support --enable-plugin --enable-default-pie 
> --with-system-zlib --enable-libphobos-checking=release 
> --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch 
> --enable-fix-cortex-a53-843419 --disable-werror 
> --enable-offload-targets=nvptx-none=/build/gcc-15-BXQoGT/gcc-15-15.2.0/debian/tmp-nvptx/usr
>  --enable-offload-defaulted --without-cuda-driver --enable-checking=release 
> --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu 
> --with-build-config=bootstrap-lto-lean --enable-link-serialization=4
> Thread model: posix
> Supported LTO compression algorithms: zlib zstd
> gcc version 15.2.0 (Ubuntu 15.2.0-16ubuntu1) 

* the system type;

> Linux {redacted} 7.0.0-22-generic #22-Ubuntu SMP PREEMPT_DYNAMIC Mon May 25 
> 15:37:49 UTC 2026 aarch64 GNU/Linux

* the complete command line that triggers the bug;

> gcc -funroll-loops -O2 ~/repromain.c
> ./a.out

(`abort()` will be called on failure.)

* the compiler output (error messages, warnings, etc.); and

No output messages with -Wall, -Wextra and -pedantic

* the preprocessed file (*.i*) that triggers the bug ...

The .s file produced by the following command is attached:

> gcc -funroll-loops -O2 repromain.c -save-temps

Reply via email to