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

2018-12-18 Thread anders.granlund.0 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88526

Anders Granlund  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Anders Granlund  ---
This is not a bug in gcc. It is clang that has the incorrect behaviour.

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

2018-12-17 Thread anders.granlund.0 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88526

--- Comment #2 from Anders Granlund  ---
Thanks for the clarification.

I'll report this bug for clang instead.

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

2018-12-17 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88526

--- Comment #1 from 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.