This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] variable size arrays in nested functions
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Subject: Re: [PATCH] variable size arrays in nested functions
- From: Per Bothner <per at bothner dot com>
- Date: 10 Feb 2001 10:13:57 -0800
- Cc: gcc at gcc dot gnu dot org
- References: <10102100231.AA09296@vlsi1.ultra.nyu.edu>
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/