You already have the answer, but just to elaborate on why part, let me add my two cents.
First, about lifetime: (quoting C11
, chapter §6.2.4/P2)
The lifetime of an object is the portion of program execution during which storage is
guaranteed to be reserved for it. An object exists, has a constant address,33) and retains
its last-stored value throughout its lifetime.34)
Then, static storage duration: (quoting P3)
An object whose identifier is declared without the storage-class specifier
_Thread_local
, and either with external or internal linkage or with the storage-class
specifier static
, has static storage duration. Its lifetime is the entire execution of the
program and its stored value is initialized only once, prior to program startup.
and , the linkage: (chapter §6.2.3/P5)
[...] If
the declaration of an identifier for an object has file scope and no storage-class specifier,
its linkage is external.
So, in this case, a
is to have static storage duration.
Now, by definition, VLA dimension is acquired at runtime, so there's noway compiler can know and allocate memory/storage and initialize it at the beginning (prior to program startup, as required for static storage duration), hence this is a conflict.
As mentioned in C11
chapter 6.7.6.2, standard explicitly forbids this.
[...] If an identifier is declared to be an object with static or thread storage
duration, it shall not have a variable length array type.