https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90292
Alexander Monakov <amonakov at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |amonakov at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from Alexander Monakov <amonakov at gcc dot gnu.org> --- The compiler cannot perform this hoisting, because the computation 'n*(i) + (j)' happens in 'unsigned int' type, where wrapping overflow matters when pointers are 64-bit. If the testcase is changed to either use 'int' (undefined overflow) or 'unsigned long' (same as pointer size), the desired hoisting is performed, as far as I can tell. Therefore, closing as invalid. (it's not rare that using size_t for array indexes helps optimization, this is one of such examples)