https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95903
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 48788 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48788&action=edit gcc11-pr95903.patch Untested fix. I don't really care what clang generates or what you find expected on ilp32 targets, what matters is if what GCC generates is fast, and unless somebody finds a wrong-code issue with that, it doesn't need to be changed. For the lp64 case, I can imagine a testcase, though it will be pretty rare in practice and we need to slow down -fwrapv generated code because of that (isn't e.g. Linux kernel built with -fwrapv?), just don't want to add it into the testsuite as that would require allocating at least 4GB of memory. On the other side, on: extern char arr[]; char baz (int off) { off += 1; return arr[off]; } char qux (int off) { return arr[off + 1]; } we do generate the addition and then sign extension, and we should not, because we would get better code otherwise. arr[INT_MIN] is in this case certainly invalid. But that is about different code.