Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

f90 extensions in f77 compilers, test program

14 views
Skip to first unread message

Bastiaan Braams

unread,
Mar 18, 1994, 7:31:39 PM3/18/94
to
program try90
* Bas Braams, Courant Institute, NYU (bra...@cims.nyu.edu). March 1994.
* The purpose of this program is to test, by syntax check only, for the
* presence of some Fortran 90 features in a Fortran 77 environment. The
* program contains many Fortran 90 constructs that are not in the 1977
* standard, but that are a likely candidate to be found as an extension
* in Fortran 77 compilers. To run the test, compile this program under
* Fortran 77 and note the error messages. A companion file 'dummy.h'
* must be present and it must be empty or contain some Fortran comment
* line. Note that the absence of an error message for a particular
* construct does not legally guarantee anything about the compiler's
* interpretation of the construct, but one might hope that it would be
* in accordance with the Fortran 90 standard.
* The program does not look at POINTER constructs, because Fortran 90
* employs a different pointer syntax than is normally found as a
* Fortran 77 extension.
* try implicit none
implicit none
* try the include statement
include 'dummy.h'
* try exclamation mark for in-line comment
integer exclam ! this is a comment ?
* try the underscore
integer un_der
* try the quote instead of the apostrophe
character chara, charb, charc, chard
parameter (chara="'", charb='"', charc='''', chard="""")
* try explicit ASCII character intrinsics
intrinsic achar, iachar
* try alternative relational operators
logical ltst
parameter (ltst = 0==0.or.0/=0.or.0<0.or.0<=0.or.0>0.or.0>=0)
* try some long names (31 chars is the legal max in Fortran 90)
integer long5678901234a
real long5678901234b
integer longlong90123456789012a
real longlong90123456789012b
integer longlonglong345678901234567890a
real longlonglong345678901234567890b
* try binary, octal and hex in data statement
integer word0, word1, word2, wurd0, wurd1, wurd2
data word0/b'11'/, word1/o'77'/ word2/z'ff'/
data wurd0/b"11"/, wurd1/o"77"/ wurd2/z"ff"/
* try namelist declaration
integer name0
namelist /names/ name0
* try bit manipulation intrinsics
intrinsic btest, iand, ibclr, ibits, ibset, ieor, ior, ishft,
. ishftc, not
* uncontroversial things
integer i
external sub
* (end of declarations)
* try do-enddo
do i = 0, 1
enddo
* try do-while
do while (.false.)
enddo
* try multiple statements on one line
* (the first "continue" below prevents a confusing error message
* on one particular system. That system doesn't accept the ";",
* but then erroneously provides an error message for the previous
* do-while.)
continue
continue ; continue
* try namelist write
* (note, we only test the Fortran 90 syntax, not the output. The
* output may very well be in the IBM style, somewhat different than
* the Fortran 90 specification.)
name0 = 0
write (*,names)
write (*,nml=names)
* try octal and hex editing
write (*,'(1x,o2,1x,z2)') 8, 16
* try the Fortran 90 free-form limit of 39 continuation lines
* (The Fortran 90 limit for fixed-form is 19 continuation lines)
if (0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0
. +0.eq.0) continue
* uncontroversial things
call sub (2)
* ensure that variables are used
* (this just avoids some warning messages)
exclam = 0
long5678901234a = 0
long5678901234b = 0
longlong90123456789012a = 0
longlong90123456789012b = 0
longlonglong345678901234567890a = 0
longlonglong345678901234567890b = 0
un_der = 0
* end main program try90
stop
end
subroutine sub (n)
implicit none
integer n
* try zero-size array
real zero(1:0)
* try dynamic array
real wrk(0:n-1)
* ensure that variables are used
write (*,*) zero
wrk(0) = 0
return
end

Bastiaan Braams

unread,
Mar 18, 1994, 7:37:51 PM3/18/94
to
In article <2mdh5b$a...@slinky.cs.nyu.edu>, I wrote:
> program try90
[rest deleted]

Results obtained by compiling the "try90" test program are provided in the
matrix below. These results are not sanctioned by any official body and
are based on compilation checks only.

Results on DEC equipment were supplied by Steve Lionel
<lio...@quark.enet.dec.com>
Results on Epfc77 (Edinburgh Portable Compiler) were supplied by Kevin
Ritchie <ke...@epcfta.edinburgh.ac.uk>
Results on IBM VS Fortran Version 2.5 were supplied by Melvin Klassen
<KLA...@UVVM.UVic.CA>
Results on IBM VS Fortran Version 2.6 were supplied by Karen Barney
<KA...@STLVM20.VNET.IBM.COM>
Results on Laheys F77L3 and on Salford FTN77/486 were supplied by Alan
Miller <al...@mel.dms.CSIRO.AU>
Results on Cray, HP-UX, IBM-AIX, SGI IRIX and Sun SunOS by Bas Braams
<bra...@cims.nyu.edu>

Results are not supplied for any Fortran 90 compiler. The purpose of
try90.f is to test for Fortran 90 features likely to be found in some
Fortran 77 compilers; the program is definitely not intended as a test of
a Fortran 90 compiler.

The columns of the matrix indicate the tests.
(Table A)
exc: allow exclamation mark for comment
und: allow underscore
quo: allow quote instead of apostrophe
rel: allow alternative relational operators
lon: allow names of 31 characters
con: allow at least 39 continuation lines
boz: allow binary, octal and hex in a data statement
ozf: allow octal and hex in a format
bit: allow bit manipulation intrinsics
asc: allow explicit ascii intrinsics achar, iachar
(Table B)
imp: allow implicit none
inc: allow include statement
nml: allow namelist
dod: allow do-enddo
dow: allow do-while
mul: allow multiple statements on a line
zer: allow zero-sized array
dyn: allow dynamic array

The rows of the matrix indicate the compiler and operating system.
Cray Unicos: CF77 6.0, Unicos 7.0.
DEC OpenVMS VAX: DEC Fortran V6.1, OpenVMS VAX V6.0
DEC OpenVMS AXP: DEC Fortran V6.1, OpenVMS AXP V1.5
DEC OSF/1 AXP: DEC Fortran V3.3, DEC OSF/1 AXP V1.3
DEC Windows NT: DEC Fortran V1.0, Microsoft Windows NT AXP V3.1
DEC RISC ULTRIX: DEC Fortran V3.2.5, RISC ULTRIX V4.2
Epcf77: (Edinburgh Portable Compiler for UNIX)
HP-UX: HP-UX 9.1.
IBM AIX: IBM Fortran xlf 2.3, AIX 3.2.
IBM VS Fortran 2.5: VM/CMS and MVS/ESA.
IBM VS Fortran 2.6: VM/CMS and MVS/ESA.
Laheys F77L3: Version 5.20, for PC.
Salford FTN77/486: Version 2.69, for PC.
SGI IRIX: IRIX 4.0.
Sun SunOS: Sun Fortran V1.4, SunOS 4.1.3.

Entries in brackets are clarified in the notes following the table. The
test for the ascii character intrinsics was added to the program as an
afterthought, and the blanks in some table entries just mean that the test
wasn't yet in the program when the data were obtained.

Table A:
exc und quo rel lon con boz ozf bit asc
Cray Unicos: + + + - + + (+) + + -
DEC OpenVMS VAX: + + - - + + + + +
DEC OpenVMS AXP: + + (+) - + + + + +
DEC OSF/1 AXP: + + + - + + + + +
DEC Windows NT AXP: + + + - + + + + +
DEC RISC ULTRIX: + + + - + + + + +
HP-UX: + + + - + + + + + +
Epfc77: + + + - + + + + +
IBM AIX: + + + + + + + + + -
IBM VS Fortran 2.5: + + - + + + - - (+)
IBM VS Fortran 2.6: + + + + + + + + +
Laheys F77L3: + + + + + + (-) + (+) -
Salford FTN77/486: + + - - + + (+) + (+) -
SGI IRIX: + + + - + + + + + +
Sun SunOS: + + + - + (+) + + + +

Table B:
imp inc nml dod dow mul zer dyn
Cray Unicos: + + (+) + + - - +
DEC OpenVMS VAX: + + + + + - - -
DEC OpenVMS AXP: + + + + + - - -
DEC OSF/1 AXP: + + + + + - - -
DEC Windows NT AXP: + + + + + - - -
DEC RISC ULTRIX: + + + + + - - -
Epfc77: + + + + + - - -
HP-UX: + + + + + - + +
IBM AIX: + + + + + - - -
IBM VS Fortran 2.5: + + (+) + + - - -
IBM VS Fortran 2.6: + + + + + - - -
Laheys F77L3: + + + + + - - -
Salford FTN77/486: + + - + + - - -
SGI IRIX: + + + + + - + -
Sun SunOS: + + + + + - - -

Comments concerning the table entries:
Cray Unicos: boz: binary not allowed, octal and hex allowed.
Cray Unicos: nml: the i/o form with "nml=" is not allowed.
DEC OpenVMS AXP: quo: the /NOVMS qualifier must be used.
IBM VS V2.5: bit: all except ishftc are recognized.
IBM VS V2.5: nml: the i/o form with "nml=" is not allowed.
Laheys F77L3: boz: binary and octal not allowed, hex allowed.
Laheys F77L3: bit: all are supported, not all are intrinsic.
Salford FTN77: boz: binary not allowed, octal and hex allowed.
Salford FTN77: bit: all are supported, not all are intrinsic.
SunOS: con: "f77 -Nl39" must be used.

Further comments concerning the tests.
con: This is not really a test of a Fortran 90 extension, because the
Fortran 90 limits are 19 continuation lines for fixed-form source and 39
continuation lines for free form source.
asc: Fortran 90 has added these intrinsics; on any system that uses the
ASCII collating sequence equivalent functionality is supplied by the old
intrinsics char and ichar.
inc: The Fortran 90 standard says nothing about directory search in
connection with the INCLUDE statement, and compiler treatments may vary.
nml: The program only tests whether the Fortran 90 namelist syntax is
accepted by the compiler. Most Fortran 77 compilers will require that the
namelist i/o data items follow the IBM style, in which, for instance, an
i/o record is terminated by "&end" or "$end" rather than by "/".
dyn: Many compilers offer dynamic arrays through a combination of
POINTER statements and malloc-type system calls. Since that is not the
Fortran 90 style, try90.f does not test for it.

Long source lines (132 chars) are in conflict with ANSI Fortran 77 and
with fixed-form Fortran 90, but they may be of interest for making the
transition to free-form Fortran 90. Source lines of up to 132 characters
are permitted under the following compiler options:
Cray Unicos: not allowed; "cf77 -N 80" permits 80 chars.
DEC equipment: -extend_source or /extend_source
Epfc77: -e or -132
HP-UX: +es
IBM AIX: not allowed, but option -k permits a free-form input
that differs from the Fortran 90 standard.
IBM VS Fortran 2.5: not allowed.
IBM VS Fortran 2.6: not allowed.
Laheys F77L3: allowed without option.
Salford FTN77: not allowed.
SGI IRIX: -extend_source
Sun SunOS: -e

0 new messages