This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/16456] PowerPC - redundant subtract involving pointer types
- From: "nathan at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Nov 2004 11:20:47 -0000
- Subject: [Bug rtl-optimization/16456] PowerPC - redundant subtract involving pointer types
- References: <20040709175338.16456.steinmtz@us.ibm.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From nathan at gcc dot gnu dot org 2004-11-03 11:20 -------
What is happening is that convert_to_integer, which is used to convert the
subtraction result to the type of 'x', reassociates the cast from
(int)((long)ptr1 - (long)ptr2)
to
(int)ptr1 - (int)ptr2
As it thinks that's a win. Unfortunately this stops CSE noticing that
the later subtraction is actually the same.
This is another example of premature tree optimization, and it should be addressed
in the reworking of fold itself. I don't think this should be attempted at stage 3
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16456