[Bug fortran/41222] New: "-std=f95" forbids USEd functions named like f03/f08 intrisics

pablomme at googlemail dot com gcc-bugzilla@gcc.gnu.org
Tue Sep 1 23:12:00 GMT 2009


This applies to gfortran 4.4.1 as distributed with Ubuntu 9.10 alpha-4. The use
of the "-std=f95" flag causes a spurious error to be raised when the module or
program being compiled USEs a function from another module whose name matches
that of a Fortran 200x intrinsic.

I'll illustrate the bug with an example (the intrinsic function name being
'erfc' in this case):

$ cat numerical.f90
MODULE numerical
IMPLICIT NONE
PRIVATE
PUBLIC dp,erfc

INTEGER,PARAMETER :: dp=kind(1.d0)

CONTAINS

 REAL(dp) FUNCTION erfc(x)
 IMPLICIT NONE
 REAL(dp),INTENT(in) :: x
 erfc=x
 END FUNCTION erfc

END MODULE numerical
$ cat bug.f90
PROGRAM bug
USE numerical, ONLY : dp,erfc
IMPLICIT NONE
REAL(dp) f
f=erfc(1.d0)
print *,f
END PROGRAM bug
$ gfortran -c numerical.f90 
$ gfortran -o bug bug.f90 numerical.o
$ ./bug
   1.0000000000000000     
$ gfortran -std=f95 -o bug bug.f90 numerical.o
/tmp/pablo/cci42qz2.o: In function `MAIN__':
bug.f90:(.text+0x20): undefined reference to `erfc_'
collect2: ld returned 1 exit status

This can be reproduced with other function names, e.g. 'bessel_j0', etc. The
problem goes away if one renames the function, of course.


-- 
           Summary: "-std=f95" forbids USEd functions named like f03/f08
                    intrisics
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pablomme at googlemail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41222



More information about the Gcc-bugs mailing list