public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/95411] New: Program compiled with nostdlib crashes if passing double to variadic function
@ 2020-05-29 11:27 gcc at namandixit dot net
  2020-05-29 12:51 ` [Bug target/95411] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gcc at namandixit dot net @ 2020-05-29 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95411
           Summary: Program compiled with nostdlib crashes if passing
                    double to variadic function
           Product: gcc
           Version: 9.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at namandixit dot net
  Target Milestone: ---

Created attachment 48632
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48632&action=edit
Sample program to demonstrate the crash

When compiling a sample program (attached) using the command "gcc -g3 -nostdlib
-ffreestanding -lgcc a.c", if a double is passed to a variadic function, the
program crashes while entering that particular function.

In the attached program, the function `add` is called with a variadic arguement
of type double. When the program enters the function `add`, it executes the
instruction "movaps XMMWORD PTR [rbp-0x70],xmm1" and crashes with SIGSEGV.

$ gcc --version
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
$ uname -a
Linux fedora 5.6.7-200.fc31.x86_64 #1 SMP Thu Apr 23 14:22:57 UTC 2020 x86_64
x86_64 x86_64 GNU/Linux

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

* [Bug target/95411] Program compiled with nostdlib crashes if passing double to variadic function
  2020-05-29 11:27 [Bug c/95411] New: Program compiled with nostdlib crashes if passing double to variadic function gcc at namandixit dot net
@ 2020-05-29 12:51 ` rguenth at gcc dot gnu.org
  2020-05-29 13:25 ` schwab@linux-m68k.org
  2020-06-20 13:35 ` schwab@linux-m68k.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-29 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |target
     Ever confirmed|0                           |1
             Target|                            |x86_64-*-*
   Last reconfirmed|                            |2020-05-29
           Keywords|                            |wrong-code

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  Not sure what exactly goes wrong here.

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

* [Bug target/95411] Program compiled with nostdlib crashes if passing double to variadic function
  2020-05-29 11:27 [Bug c/95411] New: Program compiled with nostdlib crashes if passing double to variadic function gcc at namandixit dot net
  2020-05-29 12:51 ` [Bug target/95411] " rguenth at gcc dot gnu.org
@ 2020-05-29 13:25 ` schwab@linux-m68k.org
  2020-06-20 13:35 ` schwab@linux-m68k.org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2020-05-29 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
Unaligned stack.

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

* [Bug target/95411] Program compiled with nostdlib crashes if passing double to variadic function
  2020-05-29 11:27 [Bug c/95411] New: Program compiled with nostdlib crashes if passing double to variadic function gcc at namandixit dot net
  2020-05-29 12:51 ` [Bug target/95411] " rguenth at gcc dot gnu.org
  2020-05-29 13:25 ` schwab@linux-m68k.org
@ 2020-06-20 13:35 ` schwab@linux-m68k.org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2020-06-20 13:35 UTC (permalink / raw)
  To: gcc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
The stack must be 16 byte aligned *before* the call, not after.

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

end of thread, other threads:[~2020-06-20 13:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 11:27 [Bug c/95411] New: Program compiled with nostdlib crashes if passing double to variadic function gcc at namandixit dot net
2020-05-29 12:51 ` [Bug target/95411] " rguenth at gcc dot gnu.org
2020-05-29 13:25 ` schwab@linux-m68k.org
2020-06-20 13:35 ` schwab@linux-m68k.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).