From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,1ef3b84ca62fad7b X-Google-Attributes: gidfee84,public X-Google-Thread: 1094ba,1ef3b84ca62fad7b X-Google-Attributes: gid1094ba,public From: Toon Moene Subject: Re: fortran error? Date: 1998/03/18 Message-ID: <6eopju$pfi$2@news.utrecht.NL.net>#1/1 X-Deja-AN: 335263135 References: <3507A4A5.F8A7DDC2@matd.tu-graz.ac.at> <6ejfii$kbd@usenet.pa.dec.com> <350E95A7.41C6@still3.chem.columbia.edu> <350EDA13.2781@still3.chem.columbia.edu> Organization: Moene Computational Physics, Maartensdijk, The Netherlands Newsgroups: comp.lang.fortran,comp.unix.osf.osf1 [ I hope I can add some bits to this discussion, but might raise more questions instead ... ] Peter Shenkin wrote: [ ... about the allocation of automatic arrays ... ] > One of these was a compile-time flag for a size threshold to force > allocation of large automatics on the heap. In this scenario, the > program writer knowingly and explicitly chooses to trade speed > for reliablility. Yes, this requires a runtime test, but the > Cray isn't exactly a slouch when it comes to execution speed, and > it is Cray who implements this feature. It's not suprising Cray implemented such a feature, because, AFAIK, Cray PVP systems do not have a stack as such - the "stack" is also managed as a heap. Perhaps Jeff Drummond or one of the other Crayons listening in can elaborate on this point. > I suspect it's not less efficient, or not much less efficient, or > even more efficient, to test whether the unused part of the stack > is large enough to hold the automatics that needs to fit there, and > abort the program with a descriptive message if there's not. The point often is not that the stack isn't large enough, but that the system (either by default or because the user set a limit) doesn't "allow" the stack to grow beyond a certain limit. Note that: > VMS has always been known to run Fortran codes "fast", and Steve > Lionel mentioned that VMS has had a dynamically growable stack > since 1980. Certainly, some of the precedents I cited would be > be more efficient than that. and most Unices do it that way too: Have a "guard page" (with no access rights) at the end of the stack area to get the OS in charge when you overrun the stack and let it decide whether to enlarge stack or give you an "access violation". Note how this hints that such an error should be given a more descriptive name, as the OS itself knows what's wrong. > The Absoft compiler under LINUX is the only one I know that > terminates the program gracefully with a descriptive message > when allocation of an automatic fails. In fact, no UNIX system > I've ever encountered delivers the message you propose. Can > you cite one that does? That's neat, it means they either allocate on a heap (were they can trace the amount of memory allocated), or they translate the "segmentation violation" that results from overrunning stack limits in the appropriate message: that means they have to have a sure fire means to discriminate between this failure and a "generic" segmentation violation. -- Toon Moene (mailto:toon@moene.indiv.nluug.nl) Saturnushof 14, 3738 XG Maartensdijk, The Netherlands Phone: +31 346 214290; Fax: +31 346 214286 g77 Support: mailto:fortran@gnu.org; NWP: http://www.knmi.nl/hirlam