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

            Bug ID: 94408
           Summary: Spurious error: ‘rw_nl_grid’ must be a module
                    procedure or an external procedure
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michalak at ucar dot edu
  Target Milestone: ---

The following session log contains a listing of the reproducer program,
test.F90, and a set of compile and run commands that demonstrate the issue. 
This was collected on the NCAR supercomputer cheyenne.ucar.edu using Intel,
then PGI, then GCC Fortran compilers. Intel and PGI compile the code without
issue. Note: although the session log indicates gnu/8.3.0, the test was also
run with the most recent version of gcc installed on Cheyenne, 9.1.0, and
produced identical results.  Thank you.  


John Michalakes, Software Engineer
Cooperative Programs for the Advancement of Earth System Sciences (CPAESS)
University Corporation for Atmospheric Research
micha...@ucar.edu

===


cheyenne:/glade/u/home/michalak/nf 1007 > cat session.txt
Script started on Sun 29 Mar 2020 05:58:20 AM MDT
> cat test.F90
module mod_input
  type config_t
    integer :: domain_id
    contains
    procedure :: init      => rw_config
    procedure :: rw_nl_grid
  end type config_t
  type namelist_t
    type(config_t) :: config
  end type namelist_t
  interface
    module subroutine rw_config (this,iunit)
      implicit none
      class (config_t) :: this
      integer, intent(in), optional :: iunit
    end subroutine rw_config
    module subroutine rw_nl_grid ( this, iunit )
      implicit none
      class (config_t) :: this
      integer, optional, intent(in) :: iunit
    end subroutine rw_nl_grid
  end interface
  contains
    module subroutine rw_config (this,iunit)
      implicit none
      class (config_t) :: this
      integer, intent(in), optional :: iunit
      call this%rw_nl_grid
    end subroutine rw_config
    module subroutine rw_nl_grid ( this, iunit )
      implicit none
      class (config_t) :: this
      integer, optional, intent(in) :: iunit
    end subroutine rw_nl_grid
end module mod_input

module neptune_write_native
  contains
  subroutine Run
    use mod_input
    type(namelist_t)            :: nl
  end subroutine Run
end module neptune_write_native

> module load intel

Lmod is automatically replacing "gnu/8.3.0" with "intel/18.0.5".


Due to MODULEPATH changes, the following have been reloaded:
  1) hdf5-mpi/1.10.5     2) mpt/2.19     3) ncarcompilers/0.5.0

michalak/nf> ifort -c test.F90
michalak/nf> module load pgi

Lmod is automatically replacing "intel/18.0.5" with "pgi/19.3".


Due to MODULEPATH changes, the following have been reloaded:
  1) hdf5-mpi/1.10.5     2) mpt/2.19     3) ncarcompilers/0.5.0

> pgf90 -c test.F90
> module load gnu

Lmod is automatically replacing "pgi/19.3" with "gnu/8.3.0".


Due to MODULEPATH changes, the following have been reloaded:
  1) hdf5-mpi/1.10.5     2) mpt/2.19     3) ncarcompilers/0.5.0

> gfortran test.F90
test.F90:40:8:

     use mod_input
        1
Error: ‘rw_nl_grid’ must be a module procedure or an external procedure with an
explicit interface at (1)
michalak/nf> exit
exit

Script done on Sun 29 Mar 2020 05:59:25 AM MDT

Reply via email to