Bug 113534 - printf might report segmentation fault under -mabi=ms
Summary: printf might report segmentation fault under -mabi=ms
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-22 02:43 UTC by Haochen Jiang
Modified: 2024-01-22 02:48 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Haochen Jiang 2024-01-22 02:43:53 UTC
A reproducer:

$ /export/users/haochenj/env/build_no_bootstrap_master/gcc/xgcc -B/export/users/haochenj/env/build_no_bootstrap_master/gcc/ /export/users/haochenj/src/gcc/master/gcc/testsuite/gcc.target/i386/pr80969-4a.c -m64 -DDEBUG -fdiagnostics-plain-output -Ofast -mabi=ms -mavx512f -lm -o ./pr80969-4a.exe
$ ./pr80969-4a.exe
Segmentation fault (core dumped)

After I debug into that, where it core dumped is the "printf ("PASSED\n");" in avx-check.h.

We got:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7db887c in __strlen_evex () from /lib64/libc.so.6

It seems that the seg fault will only happen under -mabi=ms. If we eliminate -mabi=ms, no segmentation fault is detected.
Comment 1 Andrew Pinski 2024-01-22 02:48:25 UTC
This is NOT a bug as -mabi=ms changes the ABI of all of the function calls including extern ones.


Basically if you mark printf as having the GNU ABI, then it would work.