This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in loop optimize (invalid postinc to preinc transformation)
- To: Robert Dewar <dewar at gnat dot com>
- Subject: Re: Bug in loop optimize (invalid postinc to preinc transformation)
- From: Jamie Lokier <egcs at tantalophile dot demon dot co dot uk>
- Date: Sat, 30 Dec 2000 03:36:26 +0100
- Cc: aoliva at redhat dot com, denisc at overta dot ru, dkorn at pixelpower dot com, gcc at gcc dot gnu dot org, peter dot osterlund at mailbox dot swipnet dot se
- References: <20001228063958.B325234D80@nile.gnat.com>
Robert Dewar wrote:
> <<Overflow of unsigned integers has defined behaviour -- they wrap. The
> question is, what rule applies to pointer comparisons?
> >>
>
> This is a malformed question. Any pointer increment is constrained
> to require that the resulting pointer be valid. Wrapping is simply
> not an issue.
>
> If p points to a valid address in an allocated array, then P+1 is also
> valid, and there is no question of wrap. But P+2 may be beyond the
> array and therefore ill-defined, and this has nothing to do with wrapping.
Quite. There's a pointer constant in the offending code. It's not in
any array. Do we offer implementation defined behaviour for numerical
pointer constants or not? They do come in useful occasionally.
-- Jamie