Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!novavax!hcx1!tom From: tom@ssd.csd.harris.com (Tom Horsley) Newsgroups: comp.lang.perl Subject: Re: Bugs in perl 3.0 pl 8 -- return statement Message-ID: Date: 17 Feb 90 13:46:26 GMT References: <4080004@hpausla.aso.hp.com> <4080005@hpausla.aso.hp.com> <418@proexam.UUCP> <7000@jpl-devvax.JPL.NASA.GOV> <7068@jpl-devvax.JPL.NASA.GOV> <5716@videovax.tv.tek.com> <7080@jpl-devvax.JPL.NASA.GOV> Sender: news@hcx1.SSD.CSD.HARRIS.COM Organization: Harris Computer Systems Division Lines: 50 In-reply-to: lwall@jpl-devvax.JPL.NASA.GOV's message of 15 Feb 90 18:22:06 GMT >Ok, I'll spread a few more judicious volatiles here and there on my globals >and structure elements. Blech. All this gobblygook just to make life >a little easier for a few compiler writers. setjmp()/longjmp() are NOT >in the same class as asynchronous interrupts. That's right, they aren't, they are worse, they are a perversion that is being hidden from the compiler disguised as ordinary function calls. We don't have these problems with our Ada compiler, because exception frames and non-local gotos and wot-not are actually a part of the language. setjmp()/longjmp() must go. This is non-negotiable. :-) e+9. Meanwhile, to make this article actually have something to do with perl, I should report the results I got when I finally debugged (or at least suppressed) my "panic: corrupt saved stack index" problems: 1) You were right, VOLATILE was not being defined as volatile, but fixing this did not make the problem go away. 2) There are goto's in the if (setjmp()) code. These gotos imply that the entire body of the routine is reachable following a setjmp(), not just a few little sections of code. 3) The variables gimme, sp, retstr, tmps, go_to, and newsp are not declared volatile and are also not necessarily restored correctly following the longjmp (for some of them, it depends on whether or not any of the switch body is executed, and that depends on the value returned from longjmp). 4) When I declared these 6 variables VOLATILE, the code started working perfectly. 5) I don't actually know what specifically was happening, I stopped working on it once I got it to work in step 4, but one other experiment I made is worth reporting. I made 6 volatile variables to save these six values in, and did saves and restores around the setjmp() calls, and I *still* got the panic messages. My two best theories are a compiler bug, or one of these variables is really updated prior to the longjmp and wants to keep its updated value, not the value it had when the first setjmp() was called. P.S. Our compiler does not (yet) keep fields of structs in registers. The back end is capable of doing it, but the front end currently does not do very aggressive alias analysis (for C, Ada is another matter). -- ===================================================================== domain: tahorsley@ssd.csd.harris.com USMail: Tom Horsley uucp: ...!novavax!hcx1!tahorsley 511 Kingbird Circle or ...!uunet!hcx1!tahorsley Delray Beach, FL 33444 ======================== Aging: Just say no! ========================