Bug 20375 - ia64 varadic regression

Mark Mitchell mark@codesourcery.com
Tue Mar 8 17:06:00 GMT 2005


Nathan Sidwell wrote:

> Notice that the last specified argument 'union U' has no name.  when
> compiled for ia64-hp-hpux11.23 with -mlp64 this ICEs because of this
> bit of code in assign_parm_find_data_types
> 
>   /* Set LAST_NAMED if this is last named arg before last anonymous 
> args.  */
>   if (current_function_stdarg)
>     {
>       tree tem;
>       for (tem = TREE_CHAIN (parm); tem; tem = TREE_CHAIN (tem))
>     if (DECL_NAME (tem))
>       break;
>       if (tem == 0)
>     data->last_named = true;
>     }
> 
> That triggers on the float argument, not union.  Naming the union
> makes it trigger on the union, and compilation succeeds.  This is
> clearly wrong.
> 
> The comment doesn't make sense, arguments with and without names can
> be freely intermixed (in C++), and should not affect the ABI.  As this
> is to do with varadic parameters, is this really talking about the
> last typed argument before the varadic ones? 

Yes, it must be.  As you say, the current code is just plain bogus; the 
idea that the ABI would change for a C++ function depending on whether 
or not the argument is named is wrong, as, for example, function 
pointers would cease to work.  I suspect this is a relic of our old 
implementation of varargs, and depended on the fact that C functions do 
not have unnamed arguments.

However, the "named_arg" bit (which depends on last_named) is indeed 
passed around to all kinds of functions.  It looks like that argument is 
unused in most backends.  (For example, alpha_pass_by_reference ignores 
the "named_arg" flag.)

I suppose you could start by going through the hoooks which take a 
named_arg flag, verifying that the flag is unused in all back ends, and 
removing the flag.  Then, you could also remove it from function.c.

Oh, dear, the SH back end actually uses it.  So, SH is broken, at least 
for C++.

I'm not sure what that means, but I'd be tempted just to declare it broken.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304



More information about the Gcc mailing list