https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103670
Bug ID: 103670 Summary: Incorrect optimization of loop termination: Early exit with any optimization Product: gcc Version: 10.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: robert.muench at saphirion dot com Target Milestone: --- Created attachment 51981 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51981&action=edit Assembly output with & without -Os optimization Whenever any -Ox option is used, the loop exits after 3 rounds, even the counter should run for 6 rounds. Without any -O option, the code works as expected.