AFAIK, the 6.7.6.3p7 tells the static
keyword indicates that the pointer a should point to at least zero elements,…
6.7.6.3 7 is not the only rule that applies.
As you know, a parameter declared as an array is automatically adjusted to be a pointer. But before it is adjusted, it is a parameter declared as an array. One of the rules for array declarators is a constraint in 6.7.6.2 1:
In addition to optional type qualifiers and the keyword static, the [
and ]
may delimit an expression or *
. If they delimit an expression (which specifies the size of an array), the expression shall have an integer type. If the expression is a constant expression, it shall have a value greater than zero…
Violating 6.7.6.2 1 is a constraint violation even if 6.7.6.3 7 is satisfied.
… point to at least zero elements, a requirement that is trivially satisfied by any pointer with determinate value.
No, it is not. First, a null pointer does not point to at least zero elements because it does not point to anything.
Second, the pointer is not merely required to point to at least zero elements but specifically to the first element of an array with at least zero elements. Any array that has at least zero elements has at least one element, because 6.2.5 20 defines an array type as “contiguously allocated nonempty set of objects with a particular member object type”. So the mere fact it is an array means it has at least one element.
Therefore, even if declared int a[static 0]
, a
must point to at least one int
.