[hjl@gnu-cfl-2 tmp]$ cat x.c inline double foo (void) { return 1.0; } [hjl@gnu-cfl-2 tmp]$ gcc -S x.c [hjl@gnu-cfl-2 tmp]$ cat x.s .file "x.c" .text .ident "GCC: (GNU) 10.2.1 20210130 (Red Hat 10.2.1-11)" .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-2 tmp]$ gcc -S x.c -mno-sse x.c: In function ‘foo’: x.c:3:1: error: SSE register return with SSE disabled 3 | { | ^ [hjl@gnu-cfl-2 tmp]$
I don't see why this is a bug. GCC decides the return register early on and that is a good thing.
(In reply to Andrew Pinski from comment #1) > I don't see why this is a bug. GCC decides the return register early on and > that is a good thing. On arm64, I got [hjl@gnu-cfl-2 gcc]$ cat /tmp/x.c inline double foo (void) { return 1.0; } [hjl@gnu-cfl-2 gcc]$ ./xgcc -B./ -mgeneral-regs-only /tmp/x.c -S [hjl@gnu-cfl-2 gcc]$
Doesn't really matter. On x86_64 the ABI says that double is returned in a SSE register, so people either can't return floating point types (and pass floating point arguments to functions), or shouldn't disable SSE.
We run into this with Intel UINTR on <stdlib.h>: https://sourceware.org/bugzilla/show_bug.cgi?id=27600 We'd like to allow <stdlib.h> with -mgeneral-regs-only.
inline long double foo (void) { return 1.0; } gcc -S -O2 -mno-80387 double.c double.c: In function ‘foo’: double.c:3:1: error: x87 register return with x87 disabled 3 | { | ^
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>: https://gcc.gnu.org/g:5e2eabe1eed1e53d39923517122d3c7de2013ad4 commit r11-7735-g5e2eabe1eed1e53d39923517122d3c7de2013ad4 Author: H.J. Lu <hjl.tools@gmail.com> Date: Thu Mar 18 11:47:46 2021 -0700 x86: Issue error for return/argument only with function body If we never generate function body, we shouldn't issue errors for return nor argument. Add silent_p to i386 machine_function to avoid issuing errors for return and argument without function body. gcc/ PR target/99652 * config/i386/i386-options.c (ix86_init_machine_status): Set silent_p to true. * config/i386/i386.c (init_cumulative_args): Set silent_p to false. (construct_container): Return early for return and argument errors if silent_p is true. * config/i386/i386.h (machine_function): Add silent_p. gcc/testsuite/ PR target/99652 * gcc.dg/torture/pr99652-1.c: New test. * gcc.dg/torture/pr99652-2.c: Likewise. * gcc.target/i386/pr57655.c: Adjusted. * gcc.target/i386/pr59794-6.c: Likewise. * gcc.target/i386/pr70738-1.c: Likewise. * gcc.target/i386/pr96744-1.c: Likewise.
Fixed for GCC 11.