The following gives an ICE when compiled with -g. Removing -g, removing the
const or making data[] a constant size will allow it to be compiled.
int f(void *p, int length)
{
const struct {
int data[length];
} *array = p;
return array[0].data[0];
}
$ gcc -g -c t.c
t.c: In function f:
t.c:8: internal compiler error: Segmentation fault
$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --enable-languages=c
Thread model: posix
gcc version 4.2.1
--
Summary: [4.2.1 regression] ICE on valid variable-length
automatic array in const struct
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: radford at blackbean dot org
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33316