Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!gatech!bloom-beacon!primerd!eriador!andyj From: andyj@eriador.prime.com Newsgroups: comp.lang.c Subject: Re: effect of free() Message-ID: <192700004@eriador> Date: 8 Sep 89 20:21:00 GMT References: <246@ssp1.idca.tds.philips.nl> Lines: 35 Nf-ID: #R:ssp1.idca.tds.philips.nl:-24600:eriador:192700004:000:1943 Nf-From: eriador.prime.com!andyj Sep 8 16:21:00 1989 scott@bbxeng (Scott Amspoker) writes: > In article <10973@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: > >In article <1010@m3.mfci.UUCP> karzes@mfci.UUCP (Tom Karzes) writes: > >>Nonsense. There are no indirect or indexed references in the code above, > >>hence no opportunities for invalid address traps. Period. > > > >Loading an unmapped address descriptor into an address register may > >cause an exception on some reasonable architectures. Exclamation point. > >In other words - you cannot even *test* a pointer unless you are *sure* >there is a valid address in it. I don't think so. Is NULL some kind >of special exception? Before we waste anymore bandwidth with this topic, >does anybody actually know a specific architecture and C compiler combination >that would cause a problem on a pointer compare? Yes, the Prime 50-series architecture also must use special instructions to load pointers. The reasons are many: 1. The Prime is also a segmented architecture, and many segment addresses are not accessible to the user. 2. The Prime supports rings of protection. While the ring bits are important in protecting access, they are not part of "the address" of the object, and must therefore be masked out. 3. The Prime allows for dynamic linking. This is accomplished by creating a "faulted" pointer, which is resolved to the actual object at run-time (if it exists). Thus, a pointer must be "resolved" to its destination before it can be used in any operation (assignment, comparision, or dereference). Any comparison with the faulted pointer will yield an incorrect result. Note that the compiler makes a special check for comparison or assignment with a null pointer constant, since a null pointer would give an addressing failure if it went through the special instructions. E. Andrew Johnson (andyj@enx.prime.com) Prime Computer, Inc.