[Bug tree-optimization/107833] wrong code at -Os and above on x86_64-linux-gnu since r12-5138-ge82c382971664d6f
aldyh at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 23 14:12:18 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107833
--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Zhendong Su from comment #0)
> Compiler Explorer: https://godbolt.org/z/Tc8vbearG
>
> It appears to be a regression from 11.3.
>
> [561] % gcctk -v
> Using built-in specs.
> COLLECT_GCC=gcctk
> COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/
> x86_64-pc-linux-gnu/13.0.0/lto-wrapper
> Target: x86_64-pc-linux-gnu
> Configured with: ../gcc-trunk/configure --disable-bootstrap
> --enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
> --enable-sanitizers --enable-languages=c,c++ --disable-werror
> --enable-multilib --with-system-zlib
> Thread model: posix
> Supported LTO compression algorithms: zlib
> gcc version 13.0.0 20221123 (experimental) [master r13-4262-g1cac00d0138]
> (GCC)
> [562] %
> [562] % gcctk -O1 small.c; ./a.out
> [563] %
> [563] % gcctk -Os small.c
> [564] % ./a.out
> Segmentation fault
> [565] %
> [565] % cat small.c
> int printf(const char *, ...);
> int a, b[1] = {0}, c, *d = b, e, *f, g;
> int main() {
> int h = 0;
> for (; a < 2; a++) {
> int i;
> for (g = 0; g < 2; g++)
> if (a < h) {
> e = i % 2;
Isn't there an uninitialized read from "i" here? At least on the second time
through the outer loop, if (a < h) is true since 1 < 0.
> c = *f;
> }
> for (h = 0; h < 3; h++) {
> if (d)
> break;
d is nonzero so h will always be 0 in this function.
> i--;
> printf("0");
> }
> }
> return 0;
> }
Unless I'm missing something....
More information about the Gcc-bugs
mailing list