This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Lower VLA representation to pointers


On Wed, 11 Aug 2004, Richard Henderson wrote:

>         * c-common.h (STATEMENT_LIST_HAS_LABEL): New.
>         * c-semantics.c (add_stmt): Set it.
>         * c-decl.c (finish_decl): Use it to create a new BIND_EXPR
>         before instantiating a variable sized type.

Doesn't work for the label being in an inner block before the declaration.

void *volatile p;

int
main (void)
{
  int n = 0;
  if (0)
    {
    lab:;
    }
  int x[n % 1000 + 1];
  x[0] = 1;
  x[n % 1000] = 2;
  p = x;
  n++;
  if (n < 1000000)
    goto lab;
  return 0;
}

Do all the non-VLA variables and compound literals, whether declared 
before, during or after the VLA, still get their proper lifetime for the 
whole source code block, with just VLAs being affected?

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]