Bug 79330 - gfortran 5.4.0/6.3.0/7.0.0 misinterpret type of character literal bind(C,name=...)

Damian Rouson damian@sourceryinstitute.org
Wed Feb 1 20:27:00 GMT 2017



This a gfortran issue appears in the interface body below, but disappears if the procedure 
is implemented without a separate interface body. Apparently, the compiler is not importing 
variables from the host scope into the interface body.  Dropping the "module" from 
"module subroutine" and explicitly importing the constant via "import :: PREFIX" produces 
the same error:

$ cat caf_openmp.f90 
module caf_openmp_interface
  implicit none
  character(len=*), parameter :: PREFIX="_gfortran_"
  interface 
    module subroutine this_image() bind(C,name=PREFIX//"caf_this_image")
      implicit none
    end subroutine
  end interface
end module

$ gfortran -c caf_openmp.f90 
caf_openmp.f90:5:47:

     module subroutine this_image() bind(C,name=PREFIX//"caf_this_image")
                                               1
Error: Operands of string concatenation operator at (1) are REAL(4)/CHARACTER(1)
caf_openmp.f90:6:19:

       implicit none
                   1
Error: Unexpected IMPLICIT NONE statement in INTERFACE block at (1)
caf_openmp.f90:7:7:

     end subroutine
       1
Error: Expecting END INTERFACE statement at (1)

$ gfortran --version
GNU Fortran (MacPorts gcc7 7-20170108_0) 7.0.0 20170108 (experimental)

This was also tested with gfortran 5.4.0 and 6.3.0.  It would be great if any fix could be backported to the 5 and 6 branches as well.

Damian





More information about the Fortran mailing list