If your program crashes at run time with a message including
the text `illegal unit number', that probably is
a message from the run-time library,
The message means that your program has attempted to use a
file unit number that is out of the range accepted by
Normally, this range is 0 through 99, and the high end
of the range is controlled by a
If you can easily change your program to use unit numbers in the range 0 through 99, you should do so.
As distributed, whether as part of f2c or g77,
libf2c accepts file unit numbers only in the range
0 through 99.
For example, a statement such as `WRITE (UNIT=100)' causes
a run-time crash in
libf2c, because the unit number,
100, is out of range.
If you know that Fortran programs at your installation require
the use of unit numbers higher than 99, you can change the
value of the
MXUNIT macro, which represents the maximum unit
number, to an appropriately higher value.
To do this, edit the file gcc/libf2c/libI77/fio.h in your g77 source tree, changing the following line:
#define MXUNIT 100
Change the line so that the value of
MXUNIT is defined to be
at least one greater than the maximum unit number used by
the Fortran programs on your system.
(For example, a program that does `WRITE (UNIT=255)' would require
MXUNIT set to at least 256 to avoid crashing.)
Then build or rebuild g77 as appropriate.
Note: Changing this macro has no effect on other limits
your system might place on the number of files open at the same time.
That is, the macro might allow a program to do `WRITE (UNIT=100)',
but the library and operating system underlying
disallow it if many other files have already been opened (via
WRITE, and so on).
Information on how to increase these other limits should be found
in your system's documentation.