[Bug c/59277] New: x86_64 code generation defects when SSE instructions are disabled
aron at udel dot edu
gcc-bugzilla@gcc.gnu.org
Sun Nov 24 19:56:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59277
Bug ID: 59277
Summary: x86_64 code generation defects when SSE instructions
are disabled
Product: gcc
Version: 4.7.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: aron at udel dot edu
There are a couple of defects in GCC for x86_64 targets when -mno-sse is
specified.
(1) SSE registers are still generated in various cases. For example, the
following codes will throw an error during compilation because SSE registers
are used:
(1) double test() { return 0.0; }
(2) void test (int n, ...) {
va_list vl; va_start(vl, n);
double foo = va_arg(vl, double);
va_end(vl);
}
(2) va_arg is broken for double types, independently of the bug listed above.
When '-mno-sse' is specified, floating-point numbers are pushed to the stack by
default instead of using the SSE registers; however, the current implementation
for va_arg still looks in the register save area for FP numbers and as such it
returns garbage values.
A fix for the latter should be pretty simple, along the lines of just
defaulting to overflow area for double types similar to the following:
#define va_arg_double(va) \
(*(double*)((va->overflow_arg_area += 8, va->overflow_arg_area
It looked to me like the code to generate the ABI implementation of va_list for
x86 targets is in gcc\config\i386\i386.c.
The only question I have is that I believe fixing these the defects breaks with
the x86_64 ABI specification and wonder whether this would be an issue because
of that.
More information about the Gcc-bugs
mailing list