https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106827
Bug ID: 106827
Summary: operator++ doesn't work for enum -O2
-mcpu=cortex-m0plus
Product: gcc
Version: 11.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Created attachment 53536
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53536&action=edit
the example on godbolt.org
gcc "optimizes" away prefix and postfix operator++ for enums.
see https://godbolt.org/z/1E65Ej7aE
--> three loops, only version 3 works (presumably).