public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/116454] New: Under certain conditions, gcc produces an extra "addq $8, 40(%rsp)" instruction overfreeing the stack.
@ 2024-08-21 21:19 Liam_Kerrigan at outlook dot com
  2024-08-21 21:30 ` [Bug middle-end/116454] [12/13/14/15 Regression] `*++ptr * 1j` is handled incorrectly with -ffast-math, increments ptr twice pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: Liam_Kerrigan at outlook dot com @ 2024-08-21 21:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 116454
           Summary: Under certain conditions, gcc produces an extra "addq
                    $8, 40(%rsp)" instruction overfreeing the stack.
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Liam_Kerrigan at outlook dot com
  Target Milestone: ---

Created attachment 58973
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58973&action=edit
Compiling main.c as described above produces an executable that returns 1, but
should return 0.

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/w64devkit/bin/../libexec/gcc/x86_64-w64-mingw32/14.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: /gcc-14.2.0/configure --prefix=/w64devkit
--with-sysroot=/w64devkit/x86_64-w64-mingw32
--with-native-system-header-dir=/include --target=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --enable-static --disable-shared --with-pic
--with-gmp-include=/deps/include --with-gmp-lib=/deps/lib
--with-mpc-include=/deps/include --with-mpc-lib=/deps/lib
--with-mpfr-include=/deps/include --with-mpfr-lib=/deps/lib
--enable-languages=c,c++,fortran --enable-libgomp --enable-threads=posix
--enable-version-specific-runtime-libs --disable-dependency-tracking
--disable-lto --disable-multilib --disable-nls --disable-win32-registry
--enable-mingw-wildcard CFLAGS_FOR_TARGET=-Os CXXFLAGS_FOR_TARGET=-Os
LDFLAGS_FOR_TARGET=-s CFLAGS=-Os CXXFLAGS=-Os LDFLAGS=-s
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.2.0 (GCC)

The complete command line that triggers the bug:
gcc -ffast-math main.c -o e.exe

Potentially helpful notes:
The bug does not occur if the line "*++ptr * 1j;" is replaced with "++ptr; *ptr
* 1j;" in main.c
If that line is replaced as such, the only difference in the assembly generated
by gcc with the -S is that one of the two consecutive "addq $8, 40(%rsp)"
instructions is removed.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-09-18  9:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-21 21:19 [Bug c/116454] New: Under certain conditions, gcc produces an extra "addq $8, 40(%rsp)" instruction overfreeing the stack Liam_Kerrigan at outlook dot com
2024-08-21 21:30 ` [Bug middle-end/116454] [12/13/14/15 Regression] `*++ptr * 1j` is handled incorrectly with -ffast-math, increments ptr twice pinskia at gcc dot gnu.org
2024-08-21 21:37 ` pinskia at gcc dot gnu.org
2024-08-21 21:38 ` pinskia at gcc dot gnu.org
2024-08-21 21:59 ` Liam_Kerrigan at outlook dot com
2024-08-22  0:23 ` pinskia at gcc dot gnu.org
2024-08-22  0:45 ` pinskia at gcc dot gnu.org
2024-08-22  5:00 ` pinskia at gcc dot gnu.org
2024-08-22  5:36 ` pinskia at gcc dot gnu.org
2024-08-22  7:05 ` [Bug middle-end/116454] [12/13/14/15 Regression] `*++ptr * 1j` is handled incorrectly with -ffast-math, increments ptr twice since r0-77972-g9f5396713d9e18 rguenth at gcc dot gnu.org
2024-08-22  8:27 ` rguenth at gcc dot gnu.org
2024-08-22 11:51 ` cvs-commit at gcc dot gnu.org
2024-08-22 11:52 ` [Bug middle-end/116454] [12/13/14 " rguenth at gcc dot gnu.org
2024-09-18  9:31 ` cvs-commit at gcc dot gnu.org
2024-09-18  9:36 ` [Bug middle-end/116454] [12/13 " rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).