https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68547
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> --- That is: (array_of_elements[last_element_index] != 0) && (last_element_index < TEST_ARRAY_SIZE) You should swap those two expressions to get correct behavior.