4. How to use Fortran 77 Compiler
Contents
4.1. Introduction
This chapter describes the usage of the COINS Fortran Compiler,
which includes COINS Compiler Fortran Frontend and its driver,
constructed on top of the COINS Compiler Infrastructure.
Section two describes the installation and setup of the COINS
Fortran compiler. Section three is a user's manual of the COINS
Fortran compiler driver. Section four describes bugs and limitations
of the COINS Fortran compiler.
4.2. Installation and Setup
Although the COINS Fortran Compiler is installed as a part of the
COINS Compiler Infrastructure, a runtime library `libf2c' is required
to link and execute the object code. Since the COINS Compiler
Infrastructure package does not include the libf2c, you have to
install it independently and tell its location to the COINS Fortran
Compiler Driver.
Section 4.2.1 describes the installation of the libf2c
package. Section 4.2.2 describes settings required to tell the library
location to the driver.
4.2.1. libf2c Installation
To use COINS Compiler Fortran Frontend, you need the "libf2c"
library. If your system does not have libf2c library, you must
install libf2c libary package in your system.
The "libf2c" package is available at following URL:
f2c
http://www.netlib.org/f2c/
libf2c.zip
http://www.netlib.org/f2c/libf2c.zip
Download "libf2c.zip" and extract this archive with unzip or the like.
Install the package according to the instructions described in the
README in the archive.
For Unix Operating System or so on, copy "makefile.u" into
"Makefile" and execute "make" command like this:
% cp makefile.u Makefile
% make
After "make", you have "libf2c.a". Put it anywhere you like.
4.2.2. Fortran Driver Setup
This section describes how to tell the location of the libf2c.a to
the linker invoked by the COINS Fortran Compiler Driver.
The COINS Fortran Compiler Driver uses gcc as a linker.
When you put the libf2c.a at a directory such that you can link it
without -L option of the linker, you can skip the following settings.
Otherwise, or not confident with it, you should follow the
instructions below.
- Create a library directory
($HOME/coins is a standard library
directory location for Unix operating system. See
2.4.6. Library Directory
for details),
- Create a text file with the following content, and put it in the
library directory with a file name "settings":
libf2cLocation /directory/path/where/libf2c.a/exists
The word "libf2cLocation" is case sensitive.
The delimiter should be a TAB.
Specify a directory path where you put the libf2c.a as the
"/directory/path/...". This string is passed as an argument of the -L
option of the linker. A tilda sign (`~') and environment variables
cannot be used.
4.3. Usage
Prior to compilation, follow instructions written in section
4.2. Installation and Setup.
A class name of the COINS Fortran Compiler Driver is
"coins.driver.F77Driver". Invoke it in following manner to compile
Fortran sources.
% java -cp your/classes coins.driver.F77Driver [option ...] foo.f [bar.f ...]
Specify the `classes' directory path of the COINS compiler
infrastructure as "your/classes".
F77Driver is a subclass of coins.driver.Driver.
Therefore, any options described in
2. How to use the Compiler Driver can be
specified as "option" as well as the following one:
-coins:printhir
prints HIR and symbol table after converting each source file
into HIR.
As libf2c.a and libm.a are linked by the COINS Fortran Compiler Driver
automatically, you are not required to supply options to do so
explicitly.
More than one source file names can be specified as "foo.f bar.f ...".
After compilation, an executable file "a.out" is created at the
current working directory.
4.4. Bugs and Limitations
4.4.1. Language Specifications
COINS Compiler Fortran Frontend retrieves Fortran 77 specification
program. But it has the following restrictions:
- The variables specified in BLOCK statements can't be used with
EQUIVALENCE statements.
- The substring character type variable can't be used with
EQUIVALENCE statements.
- Incomplete ENTRY statement support.
- Incomplete READ statement support.
4.4.2. Driver Usage
COINS Fortran Compiler Driver cannot link f2c and math library when
their file names are not libf2c.a and libm.a.