https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2015-11-23 Ever confirmed|0 |1 --- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> --- Note that in practice it needs exposal of the address constant to trigger the bogus optimization. Note that the IL from the frontend is indeed the one to blame here: char * p = (char *) mmap (2147479552B, 8192, 3, 50, -1, 0); char * q = 2147483647B; if ((int) (p + 4096) - (int) q > 0) { for correctness WRT undefined overflow we need to do the subtraction in unsigned arithmetic and then interpret the result as signed (for an eventual division by element size). Same issue in the C++ frontend btw.