https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122999
Bug ID: 122999
Summary: arm: runtime error: in arm_canonicalize_comparison
../../trunk/gcc/config/arm/arm.cc:5703
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
Created attachment 62988
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62988&action=edit
C source code
For the attached C code, recent gcc trunk does this:
dcb@raspberrypi:~ $ for i in `ls ~/gcc/results.20251*n/bin/gcc`; do echo $i; $i
-c -O2 bug1156.c; done
/home/dcb/gcc/results.20251113.ubsan/bin/gcc
/home/dcb/gcc/results.20251118.ubsan/bin/gcc
/home/dcb/gcc/results.20251124.ubsan/bin/gcc
/home/dcb/gcc/results.20251203.ubsan/bin/gcc
../../trunk/gcc/config/arm/arm.cc:5703:30: runtime error: shift exponent -1 is
negative
#0 0x039d1758 in arm_canonicalize_comparison
../../trunk/gcc/config/arm/arm.cc:5703
#1 0x0552a1bc in target_canonicalize_comparison
../../trunk/gcc/combine.cc:516
#2 0x0552a1bc in simplify_comparison ../../trunk/gcc/combine.cc:13283
#3 0x0553db90 in combine_simplify_rtx ../../trunk/gcc/combine.cc:5836
on arm32 (raspberry PI 5).
Compiler is
dcb@raspberrypi:~ $ /home/dcb/gcc/results.20251203.ubsan/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/dcb/gcc/results.20251203.ubsan/bin/gcc
COLLECT_LTO_WRAPPER=/home/dcb/gcc/results.20251203.ubsan/libexec/gcc/arm-linux-gnueabihf/16.0.0/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../trunk/configure
--prefix=/home/dcb/gcc/results.20251203.ubsan --disable-doc --disable-multilib
--with-build-config=bootstrap-ubsan --with-pkgversion=9d775818e30e73c2
--enable-checking=yes --enable-languages=c,c++ --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 16.0.0 20251203 (experimental) (9d775818e30e73c2)
dcb@raspberrypi:~ $
The problem first seems to occur sometime between g:230dc6e74f73553c
and g:9d775818e30e73c2.
I will have a go at a reduction.