Date: Fri, 3 Sep 1999 09:30:24 +0200 (METDST) From: Jens Bischoff X-Sender: bischoff AT warnow DOT bre DOT airbus DOT dasa DOT de To: djgpp AT delorie DOT com Subject: Re: Program has different outputs! In-Reply-To: <37CE896E.985BA87F@etruria.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 2 Sep 1999, Tommaso Mazzoni wrote: > After successfully compiling my old fortran sources, I have found out > that the resulting executable SOMETIMES works well, sometimes it > doesn't. It's the first time that such a thing happens to me. > > The program reads some files, then performs some calculations and then > prints out the results. But to have it work properly I have to run it > four or five times in a row until a sensible output is printed. > Otherwise I get a series of "random" numbers and also NAN etc. There are many possible reasons for that. Some variables might not be initialized, try to add the options "-O2 -W -Wall -Wuninitialized" when compiling. On your UNIX workstation the Fortran compiler might automatically save all local variables (the same behaviour as if you type "SAVE " in your source code). G77 allocates local variables on the stack by default, so variables in a SUBROUTINE won't be SAVEd. You can change this default behaviour by adding "-fno-automatic" to your compiler options. Jens | | : Jens Bischoff | | --< >-- : DaimlerChrysler Aerospace Airbus GmbH | | | : Aerodynamic Data Department (EFD) | | Dasa Airbus : D-28199 Bremen - Germany |