VLAs should be deallocated on a jump to before their definition, including
a jump to a label in an inner scope.
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;
}
should execute successfully.
(Mentioned in <http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00738.html>.)
--
Summary: VLA deallocation
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jsm28 at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 16989
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19771