https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81388
Bug ID: 81388 Summary: Incorrect code generation with -O1 -fno-strict-overflow Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: terrelln at fb dot com Target Milestone: --- gcc 7.1 on x86 produces incorrect output for correct code. gcc 6.3 produced correct assembly. See https://godbolt.org/g/mLyxGz or below for the code and generated assembly. code: .---- // -O1 -fno-strict-overflow void bar(); void foo(char *dst) { char *const end = dst; do { bar(); dst += 2; } while (dst < end); } `---- assembly: .---- foo(char*): push rbx movabs rbx, -9223372036854775808 .L2: call bar() sub rbx, 1 jne .L2 pop rbx ret `----