Gfortran does not compile dynamo (and others)

Tim Prince tprince@myrealbox.com
Sun Feb 4 22:27:00 GMT 2007


Brooks Moses wrote:
> Ignacio Fernández Galván wrote:
>> I checked a bit more about the error. The unit that's trying to open
>> (variable "In") is number 5, and inquire says it's open before (normal)
>> with a blank filename. With the simple test I cannot reproduce the
>> error, but I was thinking maybe it was some conflict between processes.
>> Gaussian is made of different executables ("links") which are called
>> one after the other (but not by a script, the time taken by each link
>> is cumulative, it seems), could it be that some other process has
>> opened unit 5, and then there's an error when trying to open it again?
>> But it works closing it explicitly... humm.
>
> Unit 5 is standard input.  It's automatically opened.
>
> This is one of the reasons that it's very common advice on 
> comp.lang.fortran to never use unit numbers below 10 in a program.  
> Most compilers use 5 for standard input and 6 for standard output, so 
> you definitely want to avoid those, but other low numbers are fairly 
> common for this (and some also have a unit number assigned to standard 
> error, as well) and using them is likely to cause conflicts of this 
> nature on other compilers.
>
> In any case, the best solution is to use some unit number other than 
> 5, but explicitly closing unit 5 at the beginning of the program will 
> probably also work -- though closing it, on some compilers, will cause 
> problems if you try to write to "*".  (I think gfortran is immune to 
> that, but not all compilers are.)
>
This is another example of why certain compilers close an implicitly 
opened unit when it is OPENed explicitly.  Granted, OPEN(5) is not going 
to work portably among various compilers.



More information about the Fortran mailing list