Dear gcc developers,

  While trying a code snippet structured as the following code suggests I've
encountered a gcc error recovery bug. Namely, the gcc (versions 4.0-4.3, as well
as 3.2) starts leaking memory (after reporting that a variable-sized object can
not be initialized) and never exists. Strange enough, 3.3 also leaks but still
can exit gracefully. gcc-3.4 and gcc-2.95 both work as expected on this
fragment:

int main() { const int size=10; struct foo { int array[size]; int* p; };// f = { .p=0 };


struct foo f = { .p = 0 };
}

Note that putting size as a #define solves the problem, just as well as putting the array to be placed after the pointer.

  I know that initialization of variable-sized object is explicitly prohibited
by C99, but note that the size here is a constant, and that I am trying to initialize a struct containing this seemingly variable-sized array.

  I would like to know if its a known bug, and if possible I could file a proper
bug report if this helps...

  I am using Debian-packaged compilers.

Regards,

Pjotr Kourzanov



Reply via email to