https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95903
Bug ID: 95903 Summary: gcc 10: wrong code with -fwrapv Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: markus at oberhumer dot com Target Milestone: --- Link at Compiler Explorer: https://godbolt.org/z/VgNLcX The following 2 functions should generate identical code when using "-fwrapv", but the second function is missing the sign extension after the add. // compile with: gcc-10 -m64 -O2 -fwrapv char get_byte_use_add(const char* ptr, int off) { off += 1; return ptr[off]; } char get_byte_use_plus(const char* ptr, int off) { return ptr[off + 1]; // gcc: BUG }