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

            Bug ID: 88647
           Summary: Rejects valid program dereferencing pointer with
                    incomplete reference type.
           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: ---

Test case (prog.c):

  struct S *p;

  void f(void);

  int main()
  {
    f();

    *p;
  }

  struct S { int x; };

  void f()
  {
    static struct S s = { 0 };
    p = &s;
  }

Compilation command line:

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

Observed behaviour:

  The following error message was outputed:

    prog.c: In function 'main':
    prog.c:10:5: error: dereferencing pointer to incomplete type 'struct S'
       10 |     *p;
          |     ^~

Expected behaviour:

  No error message outputed.

  I can't find anything in the standard that makes the this program invalid.

Reply via email to