Path: utzoo!attcan!utgpu!watmath!julian!uwovax!7103_300 From: 7103_300@uwovax.uwo.ca Newsgroups: comp.std.c Subject: Re: Out-of-bounds pointers Message-ID: <3901.25338c9f@uwovax.uwo.ca> Date: 11 Oct 89 22:55:27 GMT References: <1009@mtxinu.UUCP> <12570028@hpclwjm.HP.COM> <868@crdos1.crd.ge.COM> <217@bbxsda.UUCP> <11234@smoke.BRL.MIL> <231@bbxsda.UUCP> <4813@tekcrl.LABS.TEK.COM> <238@bbxsda.UUCP> Lines: 21 In article <238@bbxsda.UUCP>, scott@bbxsda.UUCP (Scott Amspoker) writes: > It is customary for subroutines (such as free()) to save registers > on the stack and restore their values upon return. NOTHING IS > BEING PASSED BACK TO THE CALLER! The subroutine is merely > restoring a register to its original value. The value of the > pointer is being pushed as an argument to the subroutine. That > value ultimately is discarded. However, the register containing > the pointer may also be pushed to preserve its value. Please check > some assembly code output of practically any C compiler of a function > that uses register variables. This is an implementation issue, not a language issue. Obviously if the architecture is such that popping that value off the stack will cause a fault, then either free() will have to keep the address valid or the value should not be popped. The user shouldn't be punished if the compiler attempts to load an invalid address; but if the user explicitly codes an invalid address calculation, then all bets are off. -- Eric R. Smith ersmith@uwovax.uwo.ca ersmith@uwovax.bitnet