va_arg and Alignment
Aldy Hernandez
aldyh@redhat.com
Fri Mar 8 17:32:00 GMT 2002
>>>>> "D" == D Towner <towner@compsci.bristol.ac.uk> writes:
> The call to `f' is correctly initialised, with the long value being
> aligned on a 32-bit boundary. However, within `f', the va_arg line will
> try to load the long value from a location which isn't on the correct
> boundary (i.e., the 16-bit address of the last named parameter +
> 16-bits).
You probably have to code your own vaarg implementation.
Look in the ppc port at:
rs6000_va_arg
rs6000_va_start
rs6000_build_va_list
particularly this code in va_start:
/* Care for on-stack alignment if needed. */
if (rsize <= 1)
t = ovf;
else
{
int align;
/* Vectors are 16 byte aligned. */
if (TREE_CODE (type) == VECTOR_TYPE)
align = 15;
else
align = 7;
t = build (PLUS_EXPR, TREE_TYPE (ovf), ovf, build_int_2 (align, 0));
t = build (BIT_AND_EXPR, TREE_TYPE (t), t, build_int_2 (-align-1, -1));
}
i just fixed this today :)
cheers
aldy
More information about the Gcc
mailing list