[PATCH] variable size arrays in nested functions

Per Bothner per@bothner.com
Sat Feb 10 10:06:00 GMT 2001


kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:

> What are you proposing to do, as I understand it, is to create some
> (unnamed) variable, which we'll call UV for clarity and use it instead
> of "expression2".  Where do you propose putting the statement to
> initialize it?  I suppose before the statement containing the
> expression.  But you can't since expression2 must not be evaluated if
> expression1 is true. So you have to do something peculiar, like
> perhaps an expression statement.  But if you do that haven't you
> created something with the same semantic problems as SAVE_EXPR,
> whatever they are, except thaht now it's much more complicated?

Except that we need tree nodes for "block-expressions" anyway.
I.e. gcc needs to have simple-to-use tree nodes that correspond
to the syntax of Lisp 'let'-expressions, or for that matter Gcc
block-expressions.  We use BLOCK in Gcj.  That works ok.

I.e. to calculate A[iexp] you should do something like:

({ int tmp = iexp;  check_bounds(tmp);  *(A+element_size*tmp); })

No need for SAVE_EXP.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/



More information about the Gcc mailing list