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

            Bug ID: 88817
           Summary: Diagnostics improvement: Does not detect attempt to
                    use void expression in some cases.
           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):

  extern void v;

  int main(void)
  {
    _Generic(v, default: 0);
  } 

Compilation command line:

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

Observed behaviour:

  No error messages outputed.

Possible improvement:

  The program has undefined behaviour because it attempts to use the void
  expression  v  (as the controlling expression of _Generic).

  Since GCC detects attempts to use void expressions in other case it would be
  good if it detected it in this case also.

Reply via email to