https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68840
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- ((table[i].a != val) && (i < 4)) Invokes undefined runtime behavior. You need to swap them around like: ((i < 4) && (table[i].a != val)) And then it will work correctly.