ICE when module use ENTRY from other module pgfortran

Hi!

I am getting the following error:

PGF90-F-0000-Internal compiler error. interf:new_symbol, symbol not found     625

I narrowed the source of the problem when there is an ENTRY statement from one module used in another.

This error can be reproduced with the following simple code:

File a_mod.f90

module a_mod
    use iso_fortran_env
    implicit none
    private
    public :: test, entr
    integer(kind=int32) ,public ,parameter :: a1=30
    contains
        subroutine test(a)
            implicit none 
            integer(kind=int32) ,intent(in) :: a
            integer(kind=int32)   :: ee
            print*,"sub out:",a + a1
            return
            entry entr(ee)
            print*,"entry: ", ee
        end subroutine test
end module a_mod

File b_mod.f90

module b_mod
    use a_mod, only: a1,test,entr 
end module b_mod

File prog.f90

program prog
    use iso_fortran_env
    use b_mod, only: test, a1
    implicit none 
    !
    print*, b1
end program prog

Here is the output of the commands:

% pgfortran -c a_mod.f90 b_mod.f90
a_mod.f90:
b_mod.f90:

% pgfortran -o prog prog.f90 a_mod.o b_mod.o           
prog.f90:
PGF90-F-0000-Internal compiler error. interf:new_symbol, symbol not found     625  (prog.f90: 4)
PGF90/x86-64 Linux 18.10-1: compilation aborted

This error does not occur when I use Intel or Cray Fortran compilers.

Do you have a workaround?
Could you make pgfortran compatible with this behavior?

Thanks for your help!

Hect0r

Hi Hect0r,

Thanks for the report. I’ve added TPR#26926 and sent it to our engineers for further investigation.

Probably the simplest work around is to not use “only” in b_mod. (See below).

Though, I’m wondering why you’re using ENTRY? Since the advent of F90 Modules, using ENTRY has been strongly discouraged due the complexity added to a program and the difficulty in using it. It’s recommended to use multiple module procedures in place of using ENTRY.

-Mat


% cat b_mod.f90
module b_mod
!    use a_mod, only: a1,test,entr
     use a_mod
end module b_mod
% cat prog.f90
program prog
    use iso_fortran_env
!    use b_mod, only: test, a1
    use b_mod
    implicit none
    !
    call entr(10)
    print*, a1
end program prog
% pgfortran a_mod.f90 b_mod.f90 prog.f90; a.out
a_mod.f90:
b_mod.f90:
prog.f90:
 entry:            10
           30

Hi Mat,

Thanks for the prompt reply,

The work around works!

The ENTRY statement comes from legacy code. Modify such code would be complex and time consuming. We are keeping them within a module for later use.

Thanks for your help!

Hect0r

TPR #26926 is fixed with PGI 20.3