delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/03/14:52:10

Date: Fri, 3 Sep 1999 09:30:24 +0200 (METDST)
From: Jens Bischoff <J DOT Bischoff AT airbus DOT dasa DOT de>
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: <Pine.HPP.3.96.990903091959.5320B-100000@warnow.bre.airbus.dasa.de>
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 <variable>" 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  <j DOT bischoff AT airbus DOT dasa DOT de> |
|   --< >--   :   DaimlerChrysler Aerospace Airbus GmbH    |
|      |      :     Aerodynamic Data Department (EFD)      |
| Dasa Airbus :          D-28199 Bremen - Germany          |
    

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019