https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116621
Bug ID: 116621
Summary: x86_64: Crash when fetching va_arg of type union
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: dimitar at gcc dot gnu.org
Target Milestone: ---
Created attachment 59054
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59054&action=edit
Program crashes when va_arg fetch is attempted
The attached test compiles, but the compiled program crashes when attempting to
fetch a va argument. On my Fedora40 x86_64-pc-linux-gnu:
$ gcc -march=x86-64 -O2 -g3 t-m.c -o t
$ ./t
Segmentation fault (core dumped)
The cause of the crash is on line 49:
arg = __builtin_va_arg (ap, union S8302);
My tests show that both GCC14.2.1 and trunk (r15-3387-gb64980b0776c8e) are
affected. Goldbot (https://godbolt.org/z/773b3zszM) shows that this issue dates
back to GCC7.
Note: The test source was manually reduced from one of many failing
`struct-layout-1.exp` tests I tried running for x86_64 gcc and clang.