public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/116479] New: [15 Regression] wrong code with -O -funroll-loops -finline-stringops -fmodulo-sched --param=max-iterations-computation-cost=637924876 on aarch64
@ 2024-08-25 12:09 zsojka at seznam dot cz
  2024-08-25 17:43 ` [Bug rtl-optimization/116479] " pinskia at gcc dot gnu.org
  2024-08-25 17:53 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: zsojka at seznam dot cz @ 2024-08-25 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 116479
           Summary: [15 Regression] wrong code with -O -funroll-loops
                    -finline-stringops -fmodulo-sched
                    --param=max-iterations-computation-cost=637924876 on
                    aarch64
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: aarch64-unknown-linux-gnu

Created attachment 58996
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58996&action=edit
reduced testcase

Output:
$ arch64-unknown-linux-gnu-gcc -O -funroll-loops -finline-stringops
-fmodulo-sched --param=max-iterations-computation-cost=637924687 testcase.c
-static
$ qemu-aarch64 -- ./a.out 
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

On the asm level:
...
foo:
...
        mov     x4, 695
        mov     x1, x3
.L2:
...
        sub     x4, x4, #8
        cbnz    x4, .L2
...
        ret

x4 wraps over 0 (since 695%8 != 0), and the program crashes with:

x4             0xfffffffffffd7c0f  -164849

$ aarch64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-aarch64/bin/aarch64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r15-3158-20240825101449-g91f549537ca-checking-yes-rtl-df-extra-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/15.0.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl
--with-sysroot=/usr/aarch64-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=aarch64-unknown-linux-gnu
--with-ld=/usr/bin/aarch64-unknown-linux-gnu-ld
--with-as=/usr/bin/aarch64-unknown-linux-gnu-as --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r15-3158-20240825101449-g91f549537ca-checking-yes-rtl-df-extra-aarch64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.0 20240825 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-25 17:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-25 12:09 [Bug rtl-optimization/116479] New: [15 Regression] wrong code with -O -funroll-loops -finline-stringops -fmodulo-sched --param=max-iterations-computation-cost=637924876 on aarch64 zsojka at seznam dot cz
2024-08-25 17:43 ` [Bug rtl-optimization/116479] " pinskia at gcc dot gnu.org
2024-08-25 17:53 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).