This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: When is it legal to compare any pair of pointers?
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: chris jefferson <caj at cs dot york dot ac dot uk>, gcc at gcc dot gnu dot org
- Date: 14 Sep 2005 14:15:43 -0300
- Subject: Re: When is it legal to compare any pair of pointers?
- References: <4326A85A.8080001@cs.york.ac.uk><20050914012718.GA3536@nevyn.them.org>
On Sep 13, 2005, Daniel Jacobowitz <drow@false.org> wrote:
> This bit binutils, in the form of a crash in a hash function on
> Solaris. I think that was pointer subtraction, rather than comparison,
> however.
> Perhaps someone who remembers this problem more clearly than
> I do can chip in if I've gotten it totally wrong.
Yep, it was pointer subtraction, and GCC actually optimized the
division, that could in theory be assumed to be exact, into a
multiplication by a large constant (aah, the wonders of modulo
arithmetics :-), and that's what broke some sorting function on
Solaris. And I was the lucky guy who got to debug that :-)
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}