This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: When is it legal to compare any pair of pointers?


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}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]