[Bug c/106843] gcc with -O2 corrupt data on stack

2022-09-05 Thread gcc at linuxmotors dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106843 --- Comment #7 from Dave A --- -fsanitize=address balked on the executable even without the -O2, even though it printed out the correct values. The stack must have been initialzed and the values persisted after the variable went out of scope. I

[Bug c/106843] gcc with -O2 corrupt data on stack

2022-09-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106843 --- Comment #6 from Andrew Pinski --- -fsanitize=address would have told you you used the address after it went out of scope.

[Bug c/106843] gcc with -O2 corrupt data on stack

2022-09-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106843 --- Comment #5 from Andrew Pinski --- 6.5.2.5 Compound literals 5 The value of the compound literal is that of an unnamed object initialized by the initializer list. If the compound literal occurs outside the body of a function, the object has

[Bug c/106843] gcc with -O2 corrupt data on stack

2022-09-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106843 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED

[Bug c/106843] gcc with -O2 corrupt data on stack

2022-09-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106843 --- Comment #3 from Andrew Pinski --- I mean compound literal not Designated initializers.

[Bug c/106843] gcc with -O2 corrupt data on stack

2022-09-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106843 --- Comment #2 from Andrew Pinski --- The temporary that stores the Designated initializer goes out of scope at the end of the statement that is inside the if statement.

[Bug c/106843] gcc with -O2 corrupt data on stack

2022-09-05 Thread gcc at linuxmotors dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106843 --- Comment #1 from Dave A --- gcc -dumpmachine x86_64-slackware-linux gcc -v Reading specs from /usr/lib64/gcc/x86_64-slackware-linux/11.2.0/specs COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-slackware-linux/11.2.0/lto-wrapper T