private module functions: misleading error message
Daniel Franke
franke.daniel@gmail.com
Tue Jul 4 09:44:00 GMT 2006
Hi all.
I do not know whether this issues qualifies for a problem report,
nevertheless gfortran's behaviour is somewhat strange and misleading:
$> cat -n foo.f90
1 MODULE foozo
2 PRIVATE
3 CONTAINS
4 LOGICAL FUNCTION foozerize()
5 foozerize = .TRUE.
6 END FUNCTION
7 END MODULE
8
9 PROGRAM xxx
10 USE foozo
11 IF ( foozerize() ) THEN
12 ! do something
13 END IF
14 END PROGRAM
$> gfortran-4.1.1 -g -Wall -Wno-implicit foo.f90
In file foo.f90:11
IF ( foozerize() ) THEN
1
Error: ELSE IF clause at (1) requires a scalar LOGICAL expression
Issues:
1. There is no ELSE IF statement to be seen anywhere
2. The module function foozerize() returns a scalar LOGICAL.
Therefore, if possible, the error should be reported as "trying to
access a private function of module foozo", similar to "member XY is
private in this context" in C++ (Ifort complains about a missing
explicit type for foozerize, at least).
Regards
Daniel
More information about the Fortran
mailing list