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

            Bug ID: 82285
           Summary: Optimizing error when using enumeration
           Product: gcc
           Version: 7.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hermantenbrugge at home dot nl
  Target Milestone: ---

Created attachment 42218
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42218&action=edit
testcase

The attached code initializes the data array wrong when using enumerations.
If the code is changed to use integers it works.
It also works if during initialization a printf is done.

The code aborts if compiled with: gcc -O3 tst.c -o tst; ./tst
The code works if compiled with: gcc -O3 tst.c -o tst -DPRINT; ./tst
De code also works if compiled with -O2.

Reply via email to