[Bug rtl-optimization/99470] Convert fixed index addition to array address offset
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 8 18:24:02 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99470
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
These functions have the same code gen though:
inline signed char arr[256];
bool f(unsigned long a, unsigned long b) {
return arr[a+128] == arr[b+128];
}
bool g(unsigned long a, unsigned long b) {
return (arr+128)[a] == (arr+128)[b];
}
----- CUT -----
The reason why int is not equivalent because signed integer overflow is
undefined plus doing the math in 64bit or 32bit would cause a huge difference
in some cases.
More information about the Gcc-bugs
mailing list