[Bug c/126412] New: csmith: wrong code with -O3 -march=arm-32 -fno-strict-aliasing

dcb314 at hotmail dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126412

            Bug ID: 126412
           Summary: csmith: wrong code with -O3 -march=arm-32
                    -fno-strict-aliasing
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Created attachment 65130
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65130&action=edit
C source code

The attached code does this on a 32 bit Raspberry PI:

$ for i in ~/gcc/results.202607*/bin/gcc; do echo $i; $i  -O3  -march=native 
-fno-strict-aliasing    -w bug1231B.c && ./a.out ; done
/home/dcb/gcc/results.20260704.asan/bin/gcc
checksum = 49DDD2CA
/home/dcb/gcc/results.20260707.asan/bin/gcc
checksum = 49DDD2CA
/home/dcb/gcc/results.20260711.asan/bin/gcc
checksum = 6BA0A111
/home/dcb/gcc/results.20260718.asan/bin/gcc
checksum = 6BA0A111
/home/dcb/gcc/results.20260724.asan/bin/gcc
checksum = 6BA0A111
$ 

Compilers are:

 $ /home/dcb/gcc/results.20260707.asan/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/dcb/gcc/results.20260707.asan/bin/gcc
COLLECT_LTO_WRAPPER=/home/dcb/gcc/results.20260707.asan/libexec/gcc/arm-linux-gnueabihf/17.0.0/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../trunk/configure
--prefix=/home/dcb/gcc/results.20260707.asan --disable-bootstrap --disable-doc
--disable-multilib --with-build-config=bootstrap-asan
--with-pkgversion=9c36ceaacc080a70 --enable-checking=yes
--enable-languages=c,c++,fortran --with-cpu=cortex-a76 --with-fpu=neon-fp-armv8
--with-float=hard --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf
--target=arm-linux-gnueabihf
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260704 (experimental) (9c36ceaacc080a70) 
$

and

$ /home/dcb/gcc/results.20260711.asan/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/dcb/gcc/results.20260711.asan/bin/gcc
COLLECT_LTO_WRAPPER=/home/dcb/gcc/results.20260711.asan/libexec/gcc/arm-linux-gnueabihf/17.0.0/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../trunk/configure
--prefix=/home/dcb/gcc/results.20260711.asan --disable-bootstrap --disable-doc
--disable-multilib --with-build-config=bootstrap-asan
--with-pkgversion=0a82c5e1187c68ac --enable-checking=yes
--enable-languages=c,c++,fortran --with-cpu=cortex-a76 --with-fpu=neon-fp-armv8
--with-float=hard --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf
--target=arm-linux-gnueabihf
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260711 (experimental) (0a82c5e1187c68ac) 
$ 

If I remove the -fno-strict-aliasing, everything seems ok.
This bug does not occur on x86_64.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.