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: [PATCH] fix PR45049, DECL_CHAIN error


On Wed, Aug 18, 2010 at 03:36:22PM +0200, Jakub Jelinek wrote:
> On Wed, Aug 18, 2010 at 06:29:59AM -0700, Nathan Froyd wrote:
> > The patch below fixes PR45049 by changing offending DECL_CHAINs back to
> > TREE_CHAINs.
> 
> PR45062 needs similar treatment.

Yes, I know.  But for PR45062, I don't think the right fix is to
s/DECL_CHAIN/TREE_CHAIN/.  The error stems from a dodgy bit of code in
grokparms:

  else if (arg_types && TREE_CODE (TREE_VALUE (arg_types)) == IDENTIFIER_NODE)
    {
      if (!funcdef_flag)
      pedwarn (input_location, 0, "parameter names (without types) in function declaration");

      arg_info->parms = arg_info->types;
      arg_info->types = 0;
      return 0;
    }

What in the world are we doing assigning a TREE_LIST (arg_info->types)
to a field that's supposed to be a chain of DECLs?  Later on,
arg_info->parms is iterated through with DECL_CHAIN and things blow up.

I *think* the right fix here is to simply NULL_TREE out arg_info->parms
if !funcdef_flag, but I have not yet constructed enough test cases to
convince myself that would not regress things.

-Nathan


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