With -std=c99 -pedantic-errors, the code void foo11d(int x[sizeof(int *[*])]); receives the diagnostics: t.c:1: warning: '[*]' not in a declaration t.c:1: error: ISO C forbids zero-size array 'x' There certainly isn't a zero-size array (a GNU extension) here; there's a use of [*] arrays that ended up being valid with the final resolution of DR#341 (see <http://gcc.gnu.org/ml/gcc-patches/2009-02/msg00133.html>) and the result of sizeof should be variable, not a constant 0, in this case.
Subject: Bug 39582 Author: jsm28 Date: Sat Apr 25 21:19:09 2009 New Revision: 146787 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146787 Log: PR c/39582 * c-typeck.c (c_expr_sizeof_type): Create a C_MAYBE_CONST_EXPR with non-null C_MAYBE_CONST_EXPR_PRE if size of a variable-length type is an integer constant. testsuite: * gcc.dg/vla-20.c: New test. Added: trunk/gcc/testsuite/gcc.dg/vla-20.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-typeck.c trunk/gcc/testsuite/ChangeLog
Fixed for 4.5.