http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51124

--- Comment #14 from Patrick Marlier <patrick.marlier at gmail dot com> 
2012-01-09 16:52:47 UTC ---
>From http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
regparm (number)
... Functions that take a variable number of arguments will continue to be
passed all of their arguments on the stack.

>From IRC: Do you know if variadic function and regparm(2) are compatible on
x86/32?
Quoting ktietz:
no they aren't (at least for IA-32).  As variadic functions require
reserved-stack-region, as va_list is in fact a stack-pointer for this target.
there might be case variadic could work, but these are exceptions. It depends
on signature. For regparm(2) the varidic would need to be at the 4th argument,
as va_start need prior argument to get proper stack-location. But this is just
a special-case.
it is a consequence of the way variadic is defined for IA-32 targets.
if calling-conventions using register(s) for argument passing, we would need to
know amount of variable part on runtime to calculate stack-clone region for it.
 In fact this would be for IA-32 possible, if function has pascal argument
ordering.

The variadic-args vs. regparm(2) issue is the blocker for
memcpy-1.c/memset-1.c.
No clue for clone-1.c since I cannot reproduce.
The eh-1.C on darwin seems to be a problem with XCode 4+
(http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00329.html). Probably a different
PR should be filled.

Patrick.

Reply via email to