This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Lower VLA representation to pointers
On Wed, 11 Aug 2004, Richard Henderson wrote:
> > void *volatile p;
> >
> > int
> > main (void)
> > {
> > int n = 0;
> > lab:;
> > int x[n % 1000 + 1];
>
> You'll find that our grammar doesn't start a new block after the
> label, even with -std=c99. Fix that and the test case will start
> working.
In standard terms there is no new block, neither after the label (which
indeed could be in a nested block) nor before the VLA, and the scope is
the same (same scope being defined as scope ending at same point) as that
of other declarations in the block. All non-VLA variables and compound
literals declared before, during and after the VLA declaration live for
the whole block in the source code. So it's not a grammar matter, but a
matter of creating artifical BIND_EXPRs at gimplification time for the
VLAs while keeping the other variables and compound literals in that
corresponding to the real block. (And tree-ssa.texi already mentions
inner BIND_EXPRs for VLAs.)
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)