[Bug c/88526] gcc accepts ill-formed program with sizeof (int [*])

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Mon Dec 17 23:12:00 GMT 2018


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

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Types with [*] are definitely complete types; the standard explicitly says 
"such arrays are nonetheless complete types".  The "'[*]' not in a 
declaration" warning is a warning, not an error with -pedantic-errors, 
because the final wording adopted for DR#341 didn't actually disallow such 
cases (lexically inside a parameter declaration but not directly part of 
the syntax for a parameter's declarator).  But even without that 
construct, you can still apply sizeof to [*] (see test gcc.dg/vla-5.c for 
example - cases such as "int foo5(int a, int b[*][*], int c[static 
sizeof(*b)]);") - it's definitely allowed to do so.


More information about the Gcc-bugs mailing list