https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79330

            Bug ID: 79330
           Summary: gfortran 5.4.0/6.3.0/7.0.0 misinterpret type of
                    character literal bind(C,name=...)
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at sourceryinstitute dot org
  Target Milestone: ---

This a gfortran issue appears in the interface body below, but doesn't
disappears if the procedure is implemented without a separate interface body.
Apparently, the compiler is not exposing 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.

Reply via email to