This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libitm] Remove variadic argument of _ITM_beginTransaction from libitm.h


On 12/29/2011 06:59 AM, Torvald Riegel wrote:
On Wed, 2011-12-28 at 21:03 -0500, Patrick Marlier wrote:
With i386, the regparm(2) is not taken into account when there is a
variadic function. All parameters are in the stack.
Since this variable argument is never used removing it is not a problem.

The ABI specifies beginTransaction as a variadic function, however. Even though we don't use that currently, there were reasons why we added that in the first place (e.g., to be able to add additional bits later on, including support for more codepaths).
I am pretty sure this is a bug in the ABI. AFAIU in 32bits, a function cannot be variadic and satisfy regparm(2).

Is there another way we can fix this?  Or is regparm in general
undefined for variadic functions?

in i386.c (init_cumulative_args): ... if (!TARGET_64BIT) { /* If there are variable arguments, then we won't pass anything in registers in 32-bit mode. */ if (stdarg_p (fntype)) { cum->nregs = 0; cum->sse_nregs = 0; cum->mmx_nregs = 0; cum->warn_avx = 0; cum->warn_sse = 0; cum->warn_mmx = 0; return; }

So I don't really see another way to fix it.
Maybe Master Aldy or Master Richard?

Patrick.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]