g77 and MXUNIT

Benjamin Joseph benjo@u.washington.edu
Thu Dec 30 02:10:00 GMT 2004

So I have this problem, and I was wondering if anyone knew how to solve 
this.  My Fortran program compiles, but at run time I get an error 
open: illegal unit number
apparent state: unit 99 named FOO$099
lately writing direct unformatted external IO

By googling, I found out that in OPEN statements the logical unit numbers 
are by default limited from 1 to 99 (in gcc), and this program exceeds 
that number (goes to 112 I think).  The solution for this seems to involve 
recompiling gcc but with gcc/libf2c/libI77/fio.h changed so that

#define MXUNIT 100   ------->  #define MXUNIT 1000

or something bigger than 100, anyway.  Okay, so I do that, and I recompile 

make -j 2 bootstrap
make install

I then recompile my code and try to run it and there is no change, I get 
the same error.  I'm not sure if my compiler options are correct, perhaps 
it is not linking to the right libraries?  Btw the code works, but we've 
compiled it before with the Intel Fortran compiler.  I've also made sure 
that any old versions of g77 have been removed so that this new one is the 
only one there.

Does anyone have any suggestions?

I'm running a dual-processor opteron, FC3 x86_64.


More information about the Gcc-help mailing list