[Bug c/95411] New: Program compiled with nostdlib crashes if passing double to variadic function

gcc at namandixit dot net gcc-bugzilla@gcc.gnu.org
Fri May 29 11:27:03 GMT 2020


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


More information about the Gcc-bugs mailing list