[PATCH] PR target/18916; Function arg passing mem align fixes.
Richard Henderson
rth@redhat.com
Wed Jan 5 10:08:00 GMT 2005
I think this fixes nothing. Or not much. The parameter is still misaligned
for its type, which means that the following should continue to fail:
typedef struct { _Complex long double a; } Scld1;
static Scld1 g1sScld1 = { 1 }, g1sScld2;
void __attribute__((noinline)) copy(Scld1 *p)
{
g1sScld2 = *p;
}
void __attribute__((noinline)) test(int n, Scld1 t)
{
copy (&t);
}
int main ()
{
test (1, g1sScld1);
if (g1sScld1.a != g1sScld2.a)
abort ();
return 0;
}
The way Sparc fixes the misaligned double problem in varargs is to
allocate a local stack temporary and copy the pieces into it. You
could (now) also use a MISALIGNED_INDIRECT_REF.
For the above case, you'd also need to add something to
assign_parm_setup_block and assign_parm_setup_stack to allocate new
local stack storage in the case of misaligned input.
That is, unless you don't wanna call the abi broken and fix it...
r~
More information about the Gcc-patches
mailing list