This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/9196] [3.4 regression] pointer arithmetic is misoptimized
- From: "zack at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Aug 2003 20:10:49 -0000
- Subject: [Bug optimization/9196] [3.4 regression] pointer arithmetic is misoptimized
- References: <20030106103602.9196.aj@suse.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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.