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

--- Comment #2 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Happens both on gcc-10.1.0 and gcc from main development branch. Here is the
example of -O1/-O2 difference:

$ hppa2.0-unknown-linux-gnu-gcc -lm -Wsign-compare -Wall -fno-PIE -no-pie
-fno-stack-protector -O1 bug_test.c -o good-bug
$ hppa2.0-unknown-linux-gnu-gcc -lm -Wsign-compare -Wall -fno-PIE -no-pie
-fno-stack-protector -O2 bug_test.c -o bad-bug

$ ./good-bug
long_richcompare(2, 1, EQ) = FALSE (expect FALSE)
$ ./bad-bug
long_richcompare(2, 1, EQ) = TRUE (expect FALSE)

GCC was built as:

$ hppa2.0-unknown-linux-gnu-gcc -v
Reading specs from /home/slyfox/dev/git/gcc-hppa2.0/gcc/specs
COLLECT_GCC=/home/slyfox/dev/git/gcc-hppa2.0/gcc/xgcc
COLLECT_LTO_WRAPPER=/home/slyfox/dev/git/gcc-hppa2.0/gcc/lto-wrapper
Target: hppa2.0-unknown-linux-gnu
Configured with: ../gcc/configure --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=hppa2.0-unknown-linux-gnu
--prefix=/home/slyfox/dev/git/gcc-hppa2.0/../gcc-hppa2.0-installed
--with-sysroot=/usr/hppa2.0-unknown-linux-gnu --disable-bootstrap
--enable-languages=c --disable-nls CFLAGS='-O2 -g' CXXFLAGS='-O2 -g'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.0.0 20200701 (experimental) (GCC)

Reply via email to