[Bug optimization/9196] [3.4 regression] pointer arithmetic is misoptimized
zack at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Aug 25 20:10:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9196
zack at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Additional Comments From zack at gcc dot gnu dot org 2003-08-25 20:10 -------
The C semantics for pointer arithmetic mean that GCC is allowed to assume that
this line
return __res + 1;
never causes a null pointer to be returned. The "mis-optimized" code has been
optimized based on that assumption. In short, the bug is in glibc.
The simplest fix is to write "incl %0" as the last instruction of the assembly
block rather than trying to do this calculation in C.
More information about the Gcc-bugs
mailing list