Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!pacbell.com!ames!skipper!elxsi!maine From: maine@elxsi.dfrf.nasa.gov (Richard Maine) Newsgroups: comp.lang.fortran Subject: Re: COMMON and SAVE statements Message-ID: Date: 3 Aug 90 18:38:38 GMT References: <65861@lll-winken.LLNL.GOV> Sender: news@skipper.dfrf.nasa.gov Organization: NASA Dryden, Edwards, Cal. Lines: 43 In-reply-to: ray@rogue.llnl.gov's message of 3 Aug 90 09:05:43 GMT On 3 Aug 90 09:05:43 GMT, ray@rogue.llnl.gov (Ray, Scott) said: Ray> 1. Are there any quasi-FORTRAN 77 compliant compilers on machines in Ray> widespread use in the 1990's where COMMON variables can actually Ray> become undefined when a program module is exited and a SAVE statement Ray> has not been used? In other words, is the SAVE statement really Ray> necessary in practice (ignoring the standard)? If so, on which Ray> machines and under what conditions? On CDC Cyber systems running NOS (I don't know about the newer NOS/VE systems; I haven't used them) using the segment loader (basically a form of memory overlay). Non-saved COMMON blocks could be swapped out of memory when the referencing routines returned. Program code and non-saved local variables were also swapped out. As I recall, even saved COMMON blocks and local variables could be swapped out of memory, but they were copied to disk and restored as appropriate. The non-saved ones were just discarded and became corrupted with whatever next happened to use the same memory. I recall the CDC compilers as being pretty good about standard conformance. They didn't support some of the extensions I've since become accustomed to (lower case and long variable names come to mind), but they did honest FORTRAN pretty well. Ray> 2. What could possibly be the motivation for the standard allowing Ray> variables in COMMON to be become undefined without a SAVE statement? Ray> I can't think of a case where this would be desirable behavior. Ray> Hence why isn't it built into the COMMON framework? I guess to save memory space on systems where it is tight (relative to your requirements). It certainly was tight on the Cybers of that vintage. I sure don't miss those days. Segmentation caused lots of interesting "features". Of course, it also taught me to use the SAVE statement religiously where needed. -- Richard Maine maine@elxsi.dfrf.nasa.gov [130.134.64.6]