[Bug c/101117] New: Does not diagnose invalid constant initializers with -std=c11 -pedantic -pedantic-errors

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 18 06:22:31 GMT 2021


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

            Bug ID: 101117
           Summary: Does not diagnose invalid constant initializers with
                    -std=c11 -pedantic -pedantic-errors
           Product: gcc
           Version: 11.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

const int i = 0;
static int j = i;

is not diagnosed with any option I tried - I am aware that the C standard
allows compilers to accept other forms of constant expressions but this
makes writing portable code hard.  The above is for example rejected with
GCC 7 but accepted with GCC 8 and on and there's no way to get such
code diagnosed that might not be accepted by other compilers.


More information about the Gcc-bugs mailing list