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

            Bug ID: 86694
           Summary: gfortran rejects character parameter binding label
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at sourceryinstitute dot org
  Target Milestone: ---

The consensus opinion on the J3 mailing list is that the code below is
standard-conforming. The Intel compiler accepts the code. gfortran 5.5, 6.4,
7.3, and 8.2 generate the error message below.

Damian

$ cat c-name.f90 
character(len=5), parameter :: c_name="c_foo"
interface
  subroutine foo() bind(C,name=c_name)
    import c_name
  end subroutine
end interface
end 
$ gfortran -c c-name.f90 
c-name.f90:3:31:

   subroutine foo() bind(C,name=c_name)
                               1
Error: Parameter ‘c_name’ at (1) has not been declared or is a variable, which
does not reduce to a constant expression
c-name.f90:4:10:

     import c_name
          1
Error: IMPORT statement at (1) only permitted in an INTERFACE body
c-name.f90:5:5:

   end subroutine
     1
Error: Expecting END INTERFACE statement at (1)
$ gfortran --version
GNU Fortran (GCC) 8.2.0

Reply via email to