Commit 69efc31d by Eric Botcazou Committed by Eric Botcazou

re PR rtl-optimization/12544 (ICE with large parameters used in nested functions)

	PR optimization/12544
	* function.c (put_var_into_stack): Don't generate ADDRESSOFs
	for DECL_NONLOCAL decls.

From-SVN: r72374
parent 9d82a4b3
2003-10-11 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/12544
* function.c (put_var_into_stack): Don't generate ADDRESSOFs
for DECL_NONLOCAL decls.
2003-10-11 Kazu Hirata <kazu@cs.umass.edu> 2003-10-11 Kazu Hirata <kazu@cs.umass.edu>
* expr.c: Follow spelling conventions. * expr.c: Follow spelling conventions.
......
...@@ -1324,8 +1324,9 @@ put_var_into_stack (tree decl, int rescan) ...@@ -1324,8 +1324,9 @@ put_var_into_stack (tree decl, int rescan)
if (function->decl == context) if (function->decl == context)
break; break;
/* If this is a variable-size object with a pseudo to address it, /* If this is a variable-sized object or a structure passed by invisible
put that pseudo into the stack, if the var is nonlocal. */ reference, with a pseudo to address it, put that pseudo into the stack
if the var is non-local. */
if (TREE_CODE (decl) != SAVE_EXPR && DECL_NONLOCAL (decl) if (TREE_CODE (decl) != SAVE_EXPR && DECL_NONLOCAL (decl)
&& GET_CODE (reg) == MEM && GET_CODE (reg) == MEM
&& GET_CODE (XEXP (reg, 0)) == REG && GET_CODE (XEXP (reg, 0)) == REG
...@@ -1335,8 +1336,12 @@ put_var_into_stack (tree decl, int rescan) ...@@ -1335,8 +1336,12 @@ put_var_into_stack (tree decl, int rescan)
decl_mode = promoted_mode = GET_MODE (reg); decl_mode = promoted_mode = GET_MODE (reg);
} }
/* If this variable lives in the current function and we don't need to put it
in the stack for the sake of setjmp or the non-locality, try to keep it in
a register until we know we actually need the address. */
can_use_addressof can_use_addressof
= (function == 0 = (function == 0
&& ! (TREE_CODE (decl) != SAVE_EXPR && DECL_NONLOCAL (decl))
&& optimize > 0 && optimize > 0
/* FIXME make it work for promoted modes too */ /* FIXME make it work for promoted modes too */
&& decl_mode == promoted_mode && decl_mode == promoted_mode
...@@ -1355,9 +1360,6 @@ put_var_into_stack (tree decl, int rescan) ...@@ -1355,9 +1360,6 @@ put_var_into_stack (tree decl, int rescan)
if (GET_CODE (reg) == REG) if (GET_CODE (reg) == REG)
{ {
/* If this variable lives in the current function and we don't need
to put things in the stack for the sake of setjmp, try to keep it
in a register until we know we actually need the address. */
if (can_use_addressof) if (can_use_addressof)
gen_mem_addressof (reg, decl, rescan); gen_mem_addressof (reg, decl, rescan);
else else
......
2003-10-11 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.c-torture/compile/20031011-1.c: New test.
Sat Oct 11 12:26:16 CEST 2003 Jan Hubicka <jh@suse.cz> Sat Oct 11 12:26:16 CEST 2003 Jan Hubicka <jh@suse.cz>
* g++.dg/other/first-global.C: New test. * g++.dg/other/first-global.C: New test.
......
/* PR optimization/12544 */
/* Origin: Tony Hosking <hosking@cs.purdue.edu> */
/* Verify that non-local structures passed by invisible
reference are correctly put in the stack. */
typedef struct {
int a;
int f;
} A;
A *b;
void x (A a) {
void y () {
a.a = 0;
}
b = &a;
y();
}
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