aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2005-03-10 15:04:39 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2005-03-10 15:04:39 +0000
commit8117c488e1abb823bfedf1f5c6aa73043a0458c8 (patch)
treeb6a71076da1f307f0ad5e99e7cc94e2fbca803aa /gcc/function.c
parent004c400a00547ee5ca992b393705f561811590ce (diff)
downloadgcc-8117c488e1abb823bfedf1f5c6aa73043a0458c8.zip
gcc-8117c488e1abb823bfedf1f5c6aa73043a0458c8.tar.gz
gcc-8117c488e1abb823bfedf1f5c6aa73043a0458c8.tar.bz2
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
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 9f51e92..49029a9 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1992,7 +1992,6 @@ struct assign_parm_data_one
struct locate_and_pad_arg_data locate;
int partial;
BOOL_BITFIELD named_arg : 1;
- BOOL_BITFIELD last_named : 1;
BOOL_BITFIELD passed_pointer : 1;
BOOL_BITFIELD on_stack : 1;
BOOL_BITFIELD loaded_in_reg : 1;
@@ -2136,24 +2135,15 @@ assign_parm_find_data_types (struct assign_parm_data_all *all, tree parm,
memset (data, 0, sizeof (*data));
- /* 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;
- }
-
- /* 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;
+ /* NAMED_ARG is a mis-nomer. We really mean 'non-varadic'. */
+ if (!current_function_stdarg)
+ data->named_arg = 1; /* No varadic parms. */
+ else if (TREE_CHAIN (parm))
+ data->named_arg = 1; /* Not the last non-varadic parm. */
+ else if (targetm.calls.strict_argument_naming (&all->args_so_far))
+ data->named_arg = 1; /* Only varadic ones are unnamed. */
else
- data->named_arg = !data->last_named;
+ data->named_arg = 0; /* Treat as varadic. */
nominal_type = TREE_TYPE (parm);
passed_type = DECL_ARG_TYPE (parm);
@@ -3055,7 +3045,6 @@ assign_parms (tree fndecl)
struct assign_parm_data_all all;
tree fnargs, parm;
rtx internal_arg_pointer;
- int varargs_setup = 0;
/* 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
@@ -3090,16 +3079,8 @@ assign_parms (tree fndecl)
continue;
}
- /* Handle stdargs. LAST_NAMED is a slight mis-nomer; it's also true
- 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);
- }
+ if (current_function_stdarg && !TREE_CHAIN (parm))
+ assign_parms_setup_varargs (&all, &data, false);
/* Find out where the parameter arrives in this function. */
assign_parm_find_entry_rtl (&all, &data);