Programs for Programmers

Win32 Fortran Compiler Comparisons - Diagnostic Capabilities

 

 Download Diagnostic test source code (diagnose.zip 17K)

 

Source Run-time Error Absoft ftn95 g95 gfortran Intel Lahey PGI NAG
  Percentage Passes1 33% 96% 51% 41% 55% 86% 31% 92%
  Benchmark TFFT.for execution time with diagnostic switches (seconds)2 12 22 16 8 10 436  7285 86
  Can mix checked and unchecked code Yes Yes Yes Yes Yes No Yes Yes
ARG1 argument mismatch - same file No Yes5 Yes3 No Yes4 Yes4 No Yes4
ARG2 argument mismatch - different file6 No Yes5 No No Yes4,11 Yes4 No Yes5
ARG3 Illegal assignment to constant argument - no INTENT specified No Yes5 No No Yes5,12 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 No Yes4 Yes5 No Yes4
OARG1 Illegal use of optional argument No Yes5 Yes5 No Yes5,12 Yes5 No Yes5
Source Run-time Error Absoft ftn95 g95 gfortran Intel Lahey PGI NAG
ALIAS1 Aliased dummy argument variable14 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 No9 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 No 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,12  Yes5 Yes5 Yes5 No Yes5 Yes5
Source Run-time Error Absoft ftn95 g95 gfortran Intel Lahey 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 No Yes4 Yes4 No Yes4
CBND4 character bound error - CHARACTER*(*) Yes5 Yes5 Yes5 Yes5 Yes5 Yes5 No Yes5
UIN1 uninitialized variable8 - local No Yes3,5 Yes3 Yes3 Yes5 Yes3,5 No Yes5
UIN2 uninitialized variable - argument No Yes5 No No 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 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
DO1 zero increment DO loop DIV0 Yes5 DIV05,12 No DIV05,12 Yes5 DIV0 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 Yes5
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 PGI NAG
SF1 SUBROUTINE referenced as a FUNCTION - same file No Yes5 Yes4 Yes4 Yes4 Yes4 Yes5 Yes4
SF2 SUBROUTINE referenced as a FUNCTION - different file6 No Yes5 No No Yes4,11 Yes4 No Yes5
FH1 Same file opened on 2 different units15 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 No10 Yes5 Yes5 No No Yes5 No Yes5
                 
UFL underflow Option Option Option Option Option Option Option Warning
OFL overflow Option Trap Option Option Option Option Option Trap
DIV0 divide zero Option Trap Option Option Option Option Option Trap
IOFL integer overflow Silent Option Silent Silent Silent Silent Silent Silent
  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 -L"C:\Program Files\gfortran\lib" -L"C:\Program Files\gfortran\lib\gcc\i586-pc-mingw32\4.4.0" -W -Wall -fbounds-check -pedantic-errors -std=f2003 -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
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. You can find more tests similar to 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.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 Yes - if the different files are compiled at the same time.
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 Compile time check - may be defeated in more complex cases.
10 Page Fault.
11 Compilation order dependent.  Compiler generates .mod file to allow interface checking.
12 Non-specific error message, but full traceback.
13 Compiler issued correct error, but did not specify line number.
14 Spotted by Forcheck.
15 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.