Bug 20375 - ia64 varadic regression

Mark Mitchell mark@codesourcery.com
Wed Mar 9 00:18:00 GMT 2005


Zack Weinberg wrote:

> It would certainly be nice to get rid of this mess, but Jim Wilson
> expressed concerns last time it came up:
> <http://gcc.gnu.org/ml/gcc-patches/2004-01/msg03213.html>

Well, sidestepping that, what the compiler really seems to want is "the 
last argument that was declared by the user" rather than "the last 
parameter with a name".  We have a good way of determining that: it's 
just the last parameter, nowadays, given that we've no longer got 
varargs to worry about.  So can't we just fix this loop:

   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;
     }

to iterate until the end of the loop, without checking DECL_NAME?

In C, this is not an ABI change because all parameters are named.  And, 
here, we're looking at the definition of the function, not a prototype. 
  In C++, this is an ABI change in that an unnamed parameter directly 
proceeding the ellipsis will now be treated as named, rather than 
unnamed.  That's clearly correct, but it will change the C++ ABI on 
those platforms where this makes a difference.

I would call this sufficiently much a corner case as to say that we 
should just go ahead and do it.  If we're truly paranoid, we can make 
this dependent on flag_abi_version.

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



More information about the Gcc mailing list