A declaration of a parameter as "array of type" shall be adjusted to "qualified pointer to type", where the type qualifiers (if any) are those specified within the [ and ] of the array type derivation. If the keyword static also appears within the [ and ] of the array type derivation, then for each call to the function, the value of the corresponding actual argument shall provide access to the first element of an array with at least as many elements as specified by the size expression.
Since that's a 'shall' declaration, shouldn't it at least throw out a warning?
This is an area where a compiler can (sometimes) see violations, though, so I think gcc should diagnose when possible, in the same vein as format specifier mismatches in printf().
This is not a reason to avoid the construct, but as yet gcc[1] doesn't optimize it either.
Unfortunately, though, I believe one of the -std=gnuXX variants is the default, so most people don't make that a conscious decision.
flags: -g -Wall -Wextra -std=c99 -pedantic
The following code compiles and runs (for me at least) with no errors. Tried with both stack and heap allocated arrays of various sizes.