https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93674
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- -fstrict-enums Allow the compiler to optimize using the assumption that a value of enumerated type can only be one of the values of the enumeration (as defined in the C++ standard; basically, a value that can be represented in the minimum number of bits needed to represent all the enumerators). This assumption may not be valid if the program uses a cast to convert an arbitrary integer value to the enumerated type. ---- CUT --- I assume that means since there is no negative numbers in the enum, that means you might get undefined behavior if j is negative ...