[PATCH] variable size arrays in nested functions

Jakub Jelinek jakub@redhat.com
Fri Feb 9 12:08:00 GMT 2001


On Fri, Feb 09, 2001 at 10:36:19AM -0800, Richard Henderson wrote:
> On Fri, Feb 09, 2001 at 01:17:28PM +0100, Jakub Jelinek wrote:
> > 	* c-decl.c (push_parm_decl): Call grokdeclarator always with
> > 	current_function_decl == 0, even for nested functions.
> 
> This seems strange.
> 
> > +int b;
> > +int foo (void)
> > +{
> > +  int x[b];
> > +  int bar (int t[b])
> > +  {
> 
> What about
> 
>   int foo(int b)
> 
> instead?  Doesn't dropping to no context cause this to fail?

It does not break (but ICEs without the patch).
Basically, what's going on is that variable_size takes care of putting the
SAVE_EXPR on pending list, but SAVE_EXPRs can be created deeply from fold
(the problematic SAVE_EXPR is actually created from within build_array_type
when building TREE_SIZE()). get_pending_sizes() takes care of fixing up
context of the SAVE_EXPRs recorded by variable_size but this one slips
through.
Do you think a patch using a global variable which would force save_expr to
record things into pending_sizes (like variable_size does already) would be
acceptable?

	Jakub



More information about the Gcc-patches mailing list