https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77754

--- Comment #4 from Christophe Monat <christophe.monat at st dot com> ---
(In reply to Richard Biener from comment #3)

> I wonder what the standards say about side-effects in those "declarations".

From my instance of ISO+IEC+9899-2011.pdf

6.7.6.2 Array declarators
Constraints
...
Semantics
(5) If the size is an expression that is not an integer constant expression: if
it occurs in a
declaration at function prototype scope, it is treated as if it were replaced
by *; otherwise,
each time it is evaluated it shall have a value greater than zero. The size of
each instance
of a variable length array type does not change during its lifetime. Where a
size
expression is part of the operand of a sizeof operator and changing the value
of the
size expression would not affect the result of the operator, it is unspecified
whether or not
the size expression is evaluated.

And
6.7.6.3 Function declarators (including prototypes)
(12) If the function declarator is not part of a definition of that function,
parameters may have
incomplete type and may use the [*] notation in their sequences of declarator
specifiers
to specify variable length array types.

So to me it looks, like the compiler could consider the original declaration as
if it where:
void fn2(int[][*]);

Reply via email to