Bug#1050589: gcc-13: [x32] -fbuiltin-strchr miscompiles
Package: gcc-13 Version: 13.2.0-1 Severity: normal X-Debbugs-Cc: t...@mirbsd.de I've got miscompiles of mksh with gcc-13 on x32 with dietlibc. I could reproduce this in a chroot by doing… export CC='diet -Os gcc' export CFLAGS='-g -Wformat -Werror=format-security -Wall -Wextra' export CPPFLAGS='-Wdate-time -D_FORTIFY_SOURCE=2 -DMKSH_BUILDMEAT' sh Build.sh -r -j ./mksh -c 'x=q; x=${ echo a; typeset e=2; return 3; echo x$e;}; echo .$x.' … in an mksh source tree. (Output is “..” but “.a.” was expected.) Adding -fno-builtin-strchr to CFLAGS makes the problem go away. This is as far as I could reduce this; more would involve diving into the gcc internals. -- System Information: Debian Release: trixie/sid APT prefers unreleased APT policy: (500, 'unreleased'), (500, 'unstable') Architecture: x32 (x86_64) Kernel: Linux 5.10.0-23-amd64 (SMP w/4 CPU threads) Kernel taint flags: TAINT_FIRMWARE_WORKAROUND Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: unable to detect Versions of packages gcc-13 depends on: ii binutils 2.41-4 ii cpp-13 13.2.0-1 ii gcc-13-base13.2.0-1 ii libc6 2.37-7 ii libcc1-0 13.2.0-1 ii libgcc-13-dev 13.2.0-1 ii libgcc-s1 13.2.0-1 ii libgmp10 2:6.3.0+dfsg-2 ii libisl23 0.26-3 ii libmpc31.3.1-1 ii libmpfr6 4.2.0-1 ii libstdc++6 13.2.0-1 ii libzstd1 1.5.5+dfsg2-1 ii zlib1g 1:1.2.13.dfsg-3 Versions of packages gcc-13 recommends: ii libc6-dev 2.37-7 Versions of packages gcc-13 suggests: pn gcc-13-doc pn gcc-13-locales pn gcc-13-multilib -- no debconf information
Results for 12.3.0 (Debian 12.3.0-8) testsuite on aarch64-unknown-linux-gnu
LAST_UPDATED: Obtained from git: releases/gcc-12.3.0 revision 8fc1a49c9312b05d925b7d21f1d2145d70818151 Native configuration is aarch64-unknown-linux-gnu === libatomic tests === Running target unix === libatomic Summary for unix === # of expected passes54 Running target unix/-fstack-protector === libatomic Summary for unix/-fstack-protector === # of expected passes54 === libatomic Summary === # of expected passes108 === libffi tests === Running target unix === libffi Summary for unix === # of expected passes1574 Running target unix/-fstack-protector === libffi Summary for unix/-fstack-protector === # of expected passes1574 === libffi Summary === # of expected passes3148 === libgo tests === Running target unix FAIL: os === libgo Summary === # of expected passes195 # of unexpected failures1 /build/reproducible-path/gcc-12-12.3.0/build/./gcc/gccgo version 12.3.0 (Debian 12.3.0-8) === libgomp tests === Running target unix === libgomp Summary for unix === # of expected passes13793 # of expected failures 213 # of unsupported tests 628 Running target unix/-fstack-protector === libgomp Summary for unix/-fstack-protector === # of expected passes13793 # of expected failures 213 # of unsupported tests 628 === libgomp Summary === # of expected passes27586 # of expected failures 426 # of unsupported tests 1256 === libitm tests === Running target unix === libitm Summary for unix === # of expected passes44 # of expected failures 3 # of unsupported tests 1 Running target unix/-fstack-protector === libitm Summary for unix/-fstack-protector === # of expected passes44 # of expected failures 3 # of unsupported tests 1 === libitm Summary === # of expected passes88 # of expected failures 6 # of unsupported tests 2 === libphobos tests === Running target unix FAIL: libphobos.exceptions/rt_trap_exceptions.d output pattern test FAIL: libphobos.lifetime/large_aggregate_destroy_21097.d (test for excess errors) UNRESOLVED: libphobos.lifetime/large_aggregate_destroy_21097.d compilation failed to produce executable FAIL: libphobos.phobos/std/complex.d execution test FAIL: libphobos.phobos/std/format/internal/floats.d (test for excess errors) FAIL: libphobos.phobos/std/format/internal/floats.d execution test FAIL: libphobos.phobos/std/format/internal/write.d execution test FAIL: libphobos.phobos/std/internal/math/gammafunction.d execution test FAIL: libphobos.phobos/std/math/algebraic.d execution test FAIL: libphobos.phobos/std/math/hardware.d execution test FAIL: libphobos.phobos/std/math/trigonometry.d execution test FAIL: libphobos.phobos/std/numeric.d execution test FAIL: libphobos.phobos_shared/std/complex.d execution test FAIL: libphobos.phobos_shared/std/format/internal/floats.d (test for excess errors) FAIL: libphobos.phobos_shared/std/format/internal/floats.d execution test FAIL: libphobos.phobos_shared/std/format/internal/write.d execution test FAIL: libphobos.phobos_shared/std/internal/math/gammafunction.d execution test FAIL: libphobos.phobos_shared/std/math/algebraic.d execution test FAIL: libphobos.phobos_shared/std/math/hardware.d execution test FAIL: libphobos.phobos_shared/std/math/trigonometry.d execution test FAIL: libphobos.phobos_shared/std/numeric.d execution test === libphobos Summary for unix === # of expected passes1002 # of unexpected failures20 # of unresolved testcases 1 # of unsupported tests 2 Running target unix/-fstack-protector FAIL: libphobos.exceptions/rt_trap_exceptions.d output pattern test FAIL: libphobos.lifetime/large_aggregate_destroy_21097.d (test for excess errors) UNRESOLVED: libphobos.lifetime/large_aggregate_destroy_21097.d compilation failed to produce executable FAIL: libphobos.phobos/std/complex.d execution test FAIL: libphobos.phobos/std/format/internal/floats.d (test for excess errors) FAIL: libphobos.phobos/std/format/internal/floats.d execution test FAIL: libphobos.phobos/std/format/internal/write.d execution test FAIL: libphobos.phobos/std/internal/math/gammafunction.d execution test FAIL: libphobos.phobos/std/math/algebraic.d execution test FAIL: libphobos.phobos/std/math/hardware.d execution test FAIL: libphobos.phobos/std/math/trigonometry.d execution test FAIL: libphobos.phobos/std/numeric.d execution test FAIL: libphobos.phobos_shared/std/complex.d execution test FAIL: libphobos.phobos_shared/std/format/internal
Bug#1050589: gcc-13: [x32] -fbuiltin-strchr miscompiles
Dixi quod… >Package: gcc-13 >Version: 13.2.0-1 This is a regression against gcc-12 (= 12.3.0-8); if I install that and export CC='diet -Os gcc-12' it works. >./mksh -c 'x=q; x=${ echo a; typeset e=2; return 3; echo x$e;}; echo .$x.' In case this is relevant: that codepath uses setjmp/longjmp quite a bit, and builds for glibc, musl or klibc don’t trigger this, so it’s probably a combination of several things. Using dietlibc/amd64 is also fine, and dietlibc-wise, they are good as identical: differ only in start.S and syscall numbers, and a few sections in header files. bye, //mirabilos -- you introduced a merge commit│ % g rebase -i HEAD^^ sorry, no idea and rebasing just fscked │ Segmentation should have cloned into a clean repo │ fault (core dumped) if I rebase that now, it's really ugh │ wuahh
Processed: your mail
Processing commands for cont...@bugs.debian.org: > forwarded 1050589 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65 Bug #1050589 [gcc-13] gcc-13: [x32] -fbuiltin-strchr miscompiles Set Bug forwarded-to-address to 'https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65'. > thanks Stopping processing here. Please contact me if you need assistance. -- 1050589: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050589 Debian Bug Tracking System Contact ow...@bugs.debian.org with problems