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

anders.granlund.0 at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Dec 16 23:03:00 GMT 2018


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

            Bug ID: 88526
           Summary: gcc accepts ill-formed program with sizeof (int [*])
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

Consider the following C11 program (prog.c):

  void f(int a[sizeof(int [*])]);

  int main()
  {
  }

Compiling it with

  gcc prog.c -std=c11 -pedantic-errors

gives no errors. The expected behaviour is that it should compile with at least
one error. This becuase the flag  -pedantic-errors  was used and because the
program is incorrect according to the C11 standard (taking sizeof int [*]
should not be possible since it is not a complete type).


More information about the Gcc-bugs mailing list