PATCH for PR6445
Mark Mitchell
mark@codesourcery.com
Thu Apr 25 10:59:00 GMT 2002
This is a crash on __builtin_apply with -msoft-float on the x86. The
reason is that FUNCTION_VALUE_REGNO_P still returns the FIRST_FLOAT_REG
even with -msoft-float.
Without the patch, this code:
double d{} { return 3.0; }
compiled with -msoft-float results in:
fldl .LC0
which seems pretty weird given that we have no floating-point support
in our hardware.
Given this:
void f() {
return __builtin_apply(0, 0, 0);
}
we ICE.
I think this is the obvious patch, but a confirmation from an x86 back
end expert would be helpful. Maybe it would be better to deal with
this in override_options?
(It also looks like ix86_function_value_regno_p is unnecessarily using
TARGET_64BIT; the two branches look essentially the same. The 64-bit
version actually looks internally bizzarre; it says:
return ((regno) == 0 || (regno) == FIRST_FLOAT_REG
|| ((regno) == FIRST_SSE_REG && TARGET_SSE)
|| ((regno) == FIRST_FLOAT_REG && TARGET_FLOAT_RETURNS_IN_80387));
That's pretty weird; use the FIRST_FLOAT_REG, or use the FIRST_FLOAT_REG
if we have hardware floating point...)
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.368.2.9
diff -c -p -r1.368.2.9 i386.c
*** i386.c 23 Apr 2002 08:11:22 -0000 1.368.2.9
--- i386.c 25 Apr 2002 17:58:40 -0000
*************** override_options ()
*** 1192,1197 ****
--- 1192,1202 ----
&& !optimize_size)
target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
+ /* If it doesn't have floating point, it can't return floating point
+ values in the 387. */
+ if (!TARGET_80387)
+ target_flags &= ~MASK_FLOAT_RETURNS;
+
/* Figure out what ASM_GENERATE_INTERNAL_LABEL builds as a prefix. */
{
char *p;
More information about the Gcc-patches
mailing list