This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR target/18916; Function arg passing mem align fixes.
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, fjahanian at apple dot com
- Date: Wed, 5 Jan 2005 02:05:42 -0800
- Subject: Re: [PATCH] PR target/18916; Function arg passing mem align fixes.
- References: <20050101071622.GB6245@bubble.modra.org>
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~