Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!bobmon From: bobmon@iuvax.cs.indiana.edu (RAMontante) Newsgroups: comp.lang.c Subject: Re: detecting invalid pointers Message-ID: <18460@iuvax.cs.indiana.edu> Date: 11 Mar 89 18:08:13 GMT Reply-To: bobmon@iuvax.cs.indiana.edu (RAMontante) Distribution: usa Organization: malkaryotic Lines: 24 bill@twwells.UUCP (T. William Wells) <767@twwells.uucp> : -In article <3011@nunki.usc.edu> jeenglis@nunki.usc.edu (Joe English) writes: -: Take, for example, the (you guessed it) 80x86 series in -: 'large' model, where pointers aren't normalized. It's -: then possible for two pointers to point to the same location -: yet have different segment:offset pair values. Most '86 compilers -: will *not* get this comparison right, since pointers are in general -: not normalized before comparisons to save time and space. - -In which case, the compiler is broken. But we knew that...? Hmm, this leads me to a question. I think I understand that pANS requires a valid comparison of pointers that refer to the same object (esp. array). But does the compiler or run-time code need to KNOW that the pointers are to the same object for this to hold? Or is it sufficient that the pointers refer to memory that is somehow associated (by malloc'ing perhaps)? To put it another way -- If I get tricky enough with indirection, casting, etc. (but I only do legal things), is it possible/legal to wind up with a pointer comparison that is NOT guaranteed to produce a "correct" answer within the bounds of pANS? Vacationing minds hope the answer will be here when I get back....