This is the mail archive of the gcc@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]

Bug 20375 - ia64 varadic regression


Bug 20375 is logged as a C++ bug, but it is a middle end
bug that cannot be expressed in C.  Here's a reduced testcase

union U
{
  void *m[7];
};

struct C;

void f(struct C *c, float f, union U, ...)
{ }

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?  If that's so, why isn't
the test just to see if TREE_CHAIN (parm) is NULL? Later comments in
function.c mention that LAST_NAMED is misnamed.  I'm confused about what
this is really testing for.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


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