Commit 8117c488 by Nathan Sidwell Committed by Nathan Sidwell

re PR target/20375 (C++ ICE in assign_parm_find_entry_rtl)

	PR c++/20375
	* function.c (struct assign_parm_data_one): Remove last_named
	field.
	(assign_parm_find_data_types): Don't determine last_named.
	Reorder named_parm determination.
	(assign_parms): Only setup varargs on the last non-varadic
	parameter.
testsuite:
	PR c++/20375
	* g++.dg/other/stdarg3.C: New.

From-SVN: r96237
parent 004c400a
2005-03-10 Nathan Sidwell <nathan@codesourcery.com>
PR c++/20375
* function.c (struct assign_parm_data_one): Remove last_named
field.
(assign_parm_find_data_types): Don't determine last_named.
Reorder named_parm determination.
(assign_parms): Only setup varargs on the last non-varadic
parameter.
2005-03-10 Kazuhiro Inaoka <inaoka.lazuhiro@renesas.com> 2005-03-10 Kazuhiro Inaoka <inaoka.lazuhiro@renesas.com>
* config/m32r/m32r.md (load_sda_base_32): New pattern. Loads * config/m32r/m32r.md (load_sda_base_32): New pattern. Loads
......
...@@ -1992,7 +1992,6 @@ struct assign_parm_data_one ...@@ -1992,7 +1992,6 @@ struct assign_parm_data_one
struct locate_and_pad_arg_data locate; struct locate_and_pad_arg_data locate;
int partial; int partial;
BOOL_BITFIELD named_arg : 1; BOOL_BITFIELD named_arg : 1;
BOOL_BITFIELD last_named : 1;
BOOL_BITFIELD passed_pointer : 1; BOOL_BITFIELD passed_pointer : 1;
BOOL_BITFIELD on_stack : 1; BOOL_BITFIELD on_stack : 1;
BOOL_BITFIELD loaded_in_reg : 1; BOOL_BITFIELD loaded_in_reg : 1;
...@@ -2136,24 +2135,15 @@ assign_parm_find_data_types (struct assign_parm_data_all *all, tree parm, ...@@ -2136,24 +2135,15 @@ assign_parm_find_data_types (struct assign_parm_data_all *all, tree parm,
memset (data, 0, sizeof (*data)); memset (data, 0, sizeof (*data));
/* Set LAST_NAMED if this is last named arg before last anonymous args. */ /* NAMED_ARG is a mis-nomer. We really mean 'non-varadic'. */
if (current_function_stdarg) if (!current_function_stdarg)
{ data->named_arg = 1; /* No varadic parms. */
tree tem; else if (TREE_CHAIN (parm))
for (tem = TREE_CHAIN (parm); tem; tem = TREE_CHAIN (tem)) data->named_arg = 1; /* Not the last non-varadic parm. */
if (DECL_NAME (tem)) else if (targetm.calls.strict_argument_naming (&all->args_so_far))
break; data->named_arg = 1; /* Only varadic ones are unnamed. */
if (tem == 0)
data->last_named = true;
}
/* Set NAMED_ARG if this arg should be treated as a named arg. For
most machines, if this is a varargs/stdarg function, then we treat
the last named arg as if it were anonymous too. */
if (targetm.calls.strict_argument_naming (&all->args_so_far))
data->named_arg = 1;
else else
data->named_arg = !data->last_named; data->named_arg = 0; /* Treat as varadic. */
nominal_type = TREE_TYPE (parm); nominal_type = TREE_TYPE (parm);
passed_type = DECL_ARG_TYPE (parm); passed_type = DECL_ARG_TYPE (parm);
...@@ -3055,7 +3045,6 @@ assign_parms (tree fndecl) ...@@ -3055,7 +3045,6 @@ assign_parms (tree fndecl)
struct assign_parm_data_all all; struct assign_parm_data_all all;
tree fnargs, parm; tree fnargs, parm;
rtx internal_arg_pointer; rtx internal_arg_pointer;
int varargs_setup = 0;
/* If the reg that the virtual arg pointer will be translated into is /* If the reg that the virtual arg pointer will be translated into is
not a fixed reg or is the stack pointer, make a copy of the virtual not a fixed reg or is the stack pointer, make a copy of the virtual
...@@ -3090,16 +3079,8 @@ assign_parms (tree fndecl) ...@@ -3090,16 +3079,8 @@ assign_parms (tree fndecl)
continue; continue;
} }
/* Handle stdargs. LAST_NAMED is a slight mis-nomer; it's also true if (current_function_stdarg && !TREE_CHAIN (parm))
for the unnamed dummy argument following the last named argument.
See ABI silliness wrt strict_argument_naming and NAMED_ARG. So
we only want to do this when we get to the actual last named
argument, which will be the first time LAST_NAMED gets set. */
if (data.last_named && !varargs_setup)
{
varargs_setup = true;
assign_parms_setup_varargs (&all, &data, false); assign_parms_setup_varargs (&all, &data, false);
}
/* Find out where the parameter arrives in this function. */ /* Find out where the parameter arrives in this function. */
assign_parm_find_entry_rtl (&all, &data); assign_parm_find_entry_rtl (&all, &data);
......
2005-03-10 Nathan Sidwell <nathan@codesourcery.com>
PR c++/20375
* g++.dg/other/stdarg3.C: New.
2005-03-10 Jakub Jelinek <jakub@redhat.com> 2005-03-10 Jakub Jelinek <jakub@redhat.com>
PR c++/18384, c++/18327 PR c++/18384, c++/18327
......
// Copyright (C) 2005 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 8 Mar 2005 <nathan@codesourcery.com>
// PR 20375: ICE
// Origin: Joseph S. Myers <jsm28@gcc.gnu.org>
// { dg-options "-mlp64" { target "ia64-*-*" } }
union U
{
void *m[7];
};
struct C;
void f(struct C *c, float f, union U, ...)
{ }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment