The program compdiag is intended to check the diagnostic capabilities of a Fortran compiler. It does so by writing small programs and passing them to the compiler. The output is analysed and a report is generated from the findings.
The program is not meant to check whether the compiler correctly identifies syntactical mistakes (though it does not really matter, as the generated programs could easily be adapted for this purpose).
Here is an example:
@desc Function that does not always set the value @category medium real function check( x ) real :: x if ( x > 0 ) then check = 2.0 endif end function check
This code shows a function check that properly returns a value only if the argument x is positive. The line with "@desc" gives the description for this test case and the line with "@category" defines it to be of "medium" difficulty for the compiler to find.
This code may result in a message from the compiler or it may not - this depends on the compiler options. For instance, the gfortran compiler (version 4.3.2) does not report anything with default options, but when given the options -Wall -O2 (all warnings and optimisation on), it will complain:
check.f90: In function 'check': check.f90:3: warning: '__result_check' is used uninitialized in this functionOptimisation typically forces the compiler to check the code more thoroughly and therefore more warnings can be issued.
Note that the categories basic, medium and advanced are fairly subjective.
Success in the first three categories means the compiler did not accept the program or wrote a warning. Success in all other categories means the compiler did accept it. (Note: internal compiler errors are not distinguished!)
The program produces two output files: compdiag.summary with a
summary of the results only and
Both files contain a table of the number of successes per category.