Windows Fortran Compiler Diagnostic Comparisons

Source Run-time Error Absoft ftn95 g95 gfortran Intel Lahey-LF95 PGI NAG
Percentage Passes1 34% 92% 49% 47% 53% 83% 30% 91%
Benchmark TFFT.for execution time with diagnostic switches (seconds)2 3 17 8 2 5 210 11 32
Can mix checked and unchecked code Yes Yes Yes Yes Yes No Yes No
ARG1 argument mismatch – same file No Yes5 Yes3 Yes4 Yes4 Yes4 No Yes4
ARG2 argument mismatch – different file6 No Yes5 No No Yes4,8 Yes4 No Yes5
ARG3 Illegal assignment to constant argument – no INTENT specified No Yes5 No No Yes5,9 Yes5 No Yes5
ARG4 Illegal assignment to constant argument – INTENT specified Yes4 Yes4 Yes4 Yes4 Yes4 Yes4 Yes3 Yes4
ARG5 Illegal assignment to DO loop variable in SUBROUTINE – no INTENT specified No Yes5 No No No Yes5 No Yes5
ARG6 Illegal assignment to DO loop variable in SUBROUTINE – INTENT specified Yes4 Yes4 Yes4 Yes4 Yes4 Yes4 Yes3 Yes4
ARG7 Scalar constant passed to array dummy argument No Yes5 No Yes4 Yes4 Yes5 No Yes4
OARG1 Illegal use of optional argument No Yes5 Yes3 Yes4 Yes5,9 Yes5 No Yes5
Source Run-time Error Absoft ftn95 g95 gfortran Intel Lahey-LF95 PGI NAG
ALIAS1 Aliased dummy argument variable10 No No No No No No No No
ALIAS2 Aliased dummy argument array No No No No No No No No
BND1 array bound error – X(100) Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
BND2 array bound error – X(N) N is argument Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
BND3 array bound error – X(N) N is in COMMON Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
BND4 array bound error – X(N) N is in MODULE Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
BND5 array bound error – X(*) No Yes5 No No No Yes5 No Yes5
BND6 array bound error – X(M:N) M and N argument – lower bound violated Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
BND7 array bound error – automatic array Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
BND8 array bound error – allocatable array Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
BND9 multi-dimensional array bound error within overall array bounds Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
BND10 array bound error – assign to dummy argument which is larger than actual argument No Yes5 No No No Yes5 No Yes5
BND11 array bound error – pointer array component of derived type Yes5 Yes5,9 Yes5 Yes5 Yes5 No Yes5 Yes5
Source Run-time Error Absoft ftn95 g95 gfortran Intel Lahey-LF95 PGI NAG
CBND1 character bound error – local Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 No Yes5
CBND2 character bound error – COMMON Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 No Yes5
CBND3 character bound error – assign to dummy which is larger than actual argument No Yes5 No Yes5 Yes4 Yes4 No Yes4
CBND4 character bound error – CHARACTER*(*) Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 No Yes5
UIN1 uninitialized variable7 – local No Yes3,5 Yes3 Yes3 Yes5 Yes3,5 No Yes3,5
UIN2 uninitialized variable – argument No Yes5 No Yes3 No Yes3,5 No Yes5
UIN3 uninitialized variable – COMMON No Yes5 No No No Yes3,5 No Yes5
UIN4 uninitialized variable – MODULE No Yes5 No No No Yes5 No Yes5
UIN5 uninitialized array element – local No Yes5 No No No Yes5 No Yes5
UIN6 uninitialized array element – argument No Yes5 No No No Yes5 No Yes5
UIN7 uninitialized array element – COMMON No Yes5 No No No Yes5 No Yes5
Source Run-time Error Absoft ftn95 g95 gfortran Intel Lahey-LF95 PGI NAG
UIN8 uninitialized array element – MODULE No Yes5 No No No Yes5 No Yes5
UIN9 uninitialized array element – local array in SUBROUTINE No Yes5 No No No Yes3,5 No Yes5
UIN10 uninitialized array element – automatic arrays No Yes5 No No No Yes5 No Yes5
UIN11 uninitialized array element – allocatable arrays No Yes5 No No No Yes5 No Yes5
UIN12 uninitialized array element – saved arrays No Yes5 No No No No No Yes5
UIN13 uninitialized array element – INTENT(OUT) arrays No Yes5 No No No No No Yes5
UIN14 two byte array elements No No12 No No No No12 No Yes5
UIN15 one byte array elements No No12 No No No No12 No Yes5
DO1 zero increment DO loop DIV0 Yes5 DIV05,9 No DIV05,9 Yes5 No Yes5
DO2 Illegal assignment to local DO loop variable Yes4 Yes4 Yes4 Yes4 Yes4 Yes4 Yes3 Yes4
DO3 Illegal assignment to local DO loop variable via EQUIVALENCE No Yes3,5 No No No Yes3 No Yes4
DO4 Illegal assignment to DO variables in CONTAINed subprogram No Yes5 Yes3 No No Yes5 No No
Source Run-time Error Absoft ftn95 g95 gfortran Intel Lahey-LF95 PGI NAG
SF1 SUBROUTINE referenced as a FUNCTION – same file No Yes5 Yes4 Yes4 Yes4 Yes4 No Yes4
SF2 SUBROUTINE referenced as a FUNCTION – different file6 No Yes5 No No Yes4,8 Yes4 No Yes5
FH1 Same file opened on 2 different units11 No Yes Yes5 Yes5 No No Yes No
FMT1 Illegal run-time format Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5

CONF

Non-conformant array assignment Yes5 Yes5 No Yes5 No Yes5 No Yes5
PTR1 Assign via pointer after target deallocated No Yes5 No No No Yes5 No Yes5
PTR2 Assign via global pointer to local array after subprogram return No Yes5 Yes5 No No Yes5 No Yes5
UFL underflow Option Option Option Option Option Option Option Option
OFL overflow Option Trap Option Option Option Option Option Option
DIV0 divide zero Option Trap Option Option Option Option Option Option
IOFL integer overflow Silent Option Silent Silent Silent Silent Silent Option
Full trace-back from run-time errors No Yes Yes No Yes Yes No Yes

 

 

Key
DIV0 Produced Divide Exception
Silent No indication
Trap Execution halted
Option User can select Silent or Trap

 

Compiler Switches
Absoft f95 -Rb -Rc -Rp -Rs -m2 -dq -TENV:simd_imask=off -TENV:simd_dmask=off -TENV:simd_zmask=off -TENV:simd_omask=off -TENV:simd_umask=off
FTN95 ftn95 %1 /full_undef
g95 g95 -Wall -pedantic -fbounds-check -ftrace=full -std=f2003
gfortran gfortran -W -Wall -fbounds-check -pedantic-errors -Wunderflow -O -fbacktrace -ffpe-trap=zero,overflow,underflow -g
Intel ifort /check:all /fpe:0 /traceback /warn:all,nodec,interfaces /Qfp-stack-check /automatic /gen_interfaces
Lahey lf95 -chkglobal -g -co -f95 -lst -nsav -stchk -W -xref -fullwarn -trap diou
NAG f95 -C=all -C=undefined -info
PGI pgf90 -g -Mbounds -Mchkstk -Mchkptr -Mchkfpstk -Minform=inform -C -Ktrap=divz,fp,ovf,unf

 

 

Notes
Thanks to Herman D. Knoble and Arnaud Desitter for supplying some of the diagnostic tests.
1 “Percentage Passes” is calculated from a total of 53 tests. No score is assigned for exception handling.
2 Execution Time for TFFT.for, compiled using the diagnostic switches (see table above) – measured on the same machine as the benchmarks.
3 Compiler issued warning message.
4 Compiler issued fatal error message – no executable produced.
5 Run-time message.
6 Arranged so that error is not visible at compile time.
7 A variable is “uninitialized” if it has never been assigned a value. Data elements should be initialized before their value is used. The illegal use of an uninitialized variable can sometimes be detected at compile-time, but, because it may be data and flow dependent, usually requires run-time monitoring. In some cases, compilers implement this by checking for a special “uninitialized” bit pattern, such as 0x80, but this may result in false positives for one or two byte variables (and, rarely, in other cases). Use of a “shadow array” doubles memory requirements, but avoids false positives.
8 Compilation order dependent. Compiler generates .mod file to allow interface checking.
9 Non-specific error message, but full traceback.
10 Spotted by Forcheck.
11 The test is passed if the program refuses the second open. For some reason, the Fortran standard does not allow a file to be opened twice, even for read-only access. It has been argued to me that allowing the second open is an extension to the standard, rather than a failure to spot an error.
12 False positive detected

 

Download source code of tests

Return to Fortran Compiler Comparisons homepage