Linux Fortran Compiler Diagnostics Comparison (December 2014)

Source Run-time Error Absoft g95 gfortran Intel Lahey Nag Pathscale PGI Sun
Percentage Passes 1 35% 47% 43% 55% 96% 90% 39% 29% 43%
TFFT execution time with diagnostic switches (seconds)2 14 16 8 9 521 12 8 88614 13
Can mix checked and unchecked code Yes Yes Yes Yes No No Yes Yes Yes
ARG1 argument mismatch – same file No Yes3 No Yes4 Yes4 Yes4 Yes3 No Yes3
ARG2 argument mismatch – different file6 No No No Yes4,11 Yes4 Yes5 No No No
ARG3 Illegal assignment to constant argument – no INTENT specified No No No Yes4,12 Yes5 Yes5 No No No
ARG4 Illegal assignment to constant argument – INTENT specified Yes4 Yes4 Yes4 Yes4 Yes4 Yes4 Yes4 Yes3 Yes4
ARG5 Illegal assignment to DO loop variable in SUBROUTINE – no INTENT specified No No No No Yes5 Yes5 No No No
ARG6 Illegal assignment to DO loop variable in SUBROUTINE – INTENT specified Yes4 Yes4 Yes4 Yes4 Yes4 Yes4 Yes4 Yes3 Yes4
ARG7 Scalar constant passed to array dummy argument No No No Yes4 Yes5 Yes5 Yes3 No Yes3
OARG1 Illegal use of optional argument No No No Yes5,12 Yes5 Yes5 No No Yes5
Source Run-time Error Absoft g95 gfortran Intel Lahey Nag Pathscale PGI Sun
ALIAS1 Aliased dummy argument variable10 No No No No Yes5 No No7 No No
ALIAS2 Aliased dummy argument array No No No No Yes5 No No7 No No
BND1 array bound error – X(100) Yes5 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 Yes5
BND3 array bound error – X(N) N is in COMMON Yes5 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 Yes5
BND5 array bound error – X(*) No No No9 No Yes5 Yes5 No No No
BND6 array bound error – X(M:N) M and N argument – lower bound violated Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
BND7 array bound error – automatic array Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
BND8 array bound error – allocatable array Yes5 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 Yes5
BND10 array bound error – assign to dummy arg array beyond bounds of actual array No No No No Yes5 Yes5 No No No
BND11 array bound error – pointer array component of derived type Yes5 Yes5 Yes5 Yes5 No Yes5 Yes5 Yes5 Yes5
Source Run-time Error Absoft g95 gfortran Intel Lahey Nag Pathscale PGI Sun
CBND1 character bound error – local Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 No No Yes5
CBND2 character bound error – COMMON Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 No No Yes5
CBND3 character bound error – assign to dummy which is larger than actual arg No No No Yes4 Yes4 Yes5 No No No
CBND4 character bound error – CHARACTER*(*) Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 No No Yes5
UIN1 uninitialized variable8 – local No Yes3 Yes3 Yes5 Yes3,5 Yes3,5 Yes3 No No
UIN2 uninitialized variable – argument No No No No Yes3,5 Yes5 No No No
UIN3 uninitialized variable – COMMON No No No No Yes3,5 Yes5 No No No
UIN4 uninitialized variable – MODULE No No No No Yes5 Yes5 No No No
UIN5 uninitialized array element – local No No No No Yes5 Yes5 No No No
UIN6 uninitialized array element – argument No No No No Yes5 Yes5 No No No
UIN7 uninitialized array element – COMMON No No No No Yes5 Yes5 No No No
Source Run-time Error Absoft g95 gfortran Intel Lahey Nag Pathscale PGI Sun
UIN8 uninitialized array element – MODULE No No No No Yes5 Yes5 No No No
UIN9 uninitialized array element – local array in SUBROUTINE No No No No Yes3,5 Yes5 No No No
UIN10 uninitialized array element – automatic arrays No No No No Yes5 Yes5 No No No
UIN11 uninitialized array element – allocatable arrays No No No No Yes5 Yes5 No No No
UIN12 uninitialized array element – saved arrays No No No No Yes5 Yes5 No No No
UIN13 uninitialized array element – INTENT(OUT) arrays No No No No Yes5 Yes5 No No No
DO1 zero increment DO loop DIV0 DIV05,12 DIV05,12 DIV05,12 Yes5 Yes5 DIV0 DIV0 DIV0
DO2 Illegal assignment to local DO loop variable Yes4 Yes4 Yes4 Yes4 Yes4 Yes4 Yes4 Yes3 Yes4
DO3 Illegal assignment to local DO loop variable via EQUIVALENCE No No No No Yes3 Yes4 No No No
DO4 Illegal assignment to DO variables in CONTAINed subprogram No Yes3 No No Yes5 No No No No
Source Run-time Error Absoft g95 gfortran Intel Lahey Nag Pathscale PGI Sun
SF1 SUBROUTINE referenced as a FUNCTION – same file No Yes4 Yes4 Yes4 Yes4 Yes4 Yes4 No Yes4
SF2 SUBROUTINE referenced as a FUNCTION – different file6 No No No Yes4,11 Yes4 Yes5 No No No
FH1 Same file opened on 2 different units13 No Yes5 Yes5 No Yes5 No Yes Yes No
FMT1 Illegal run-time format Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 Yes5
CONF Non-conformant array assignment Yes5 No Yes5 No Yes5 Yes5 Yes5 No Yes5
PTR1 Assign via pointer after target deallocated No No No No Yes5 Yes5 No No No
PTR2 Assign via global pointer to local array after subprogram return No No No No Yes5 Yes5 No No No
UFL underflow Option Option Option Option Option Option Option Option Option
OFL overflow Option Option Option Option Option Option Option Option Option
DIV0 divide zero Option Option Option Option Option Option Option Option Option
IOFL integer overflow Silent Silent Silent Silent Silent Option Silent Silent Silent
Full trace-back from run-time errors No Yes Yes Yes Yes Yes No No No

 

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

 

Compiler Switches
Absoft af95 -Rb -Rc -Rp -Rs -m2 -dq -trap=DIVBYZERO,OVERFLOW,UNDERFLOW -et
g95
g95 -Wall -pedantic -fbounds-check -ftrace=full
gfortran gfortran -W -Wall -fbounds-check -pedantic-errors -std=f2003 -Wunderflow -O -fbacktrace -ffpe-trap=zero,overflow,underflow -g
Intel ifort -check all -warn all,nodec,interfaces -gen_interfaces -traceback -fpe0 -fp-stack-check
Lahey lf95 –chkglobal -g –co –f95 –lst –trace –nsav –warn –xref
NAG
f95 -C=all -C=undefined -info -g -gline
Pathscale pathf90 -C -Wuninitialized -fullwarn -ffortran-bounds-check -TENV:simd_omask=OFF -TENV:simd_umask=OFF -TENV:simd_zmask=OFF
PGI pgf90 -g -Mbounds -Mchkstk -Mchkptr -Mchkfpstk -Minform=inform -C
Sun sunf95 -ansi -w4 -xcheck=%all -C -ftrap=common,overflow,underflow

 

Notes
Thanks to Herman D. Knoble and Arnaud Desitter for supplying some of the diagnostic tests. You can find more tests like these at Herman’s site: //ftp.cac.psu.edu/pub/ger/fortran/test/
1 “Percentage Passes” is calculated from a total of 51 tests. No score is assigned for exception handling.
2 Execution Time for TFFT benchmark, 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 Compiler has option to allow or disallow aliasing – a change in behaviour suggests an aliasing error.
8 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.
9 Run time message “Array reference out of bounds” does not specify array name or line number.
10 Spotted by Forcheck
11 Compilation order dependent. Compiler generates .mod file to allow interface checking.
12 Non-specific error message, but full traceback.
13 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.
14 Much faster without -Mchkfpstk.