Attempt to use a SUBROUTINE as a FUNCTION

The compiler does not accept the use of a procedure pointer to a subroutine in another module:

module a

  integer v
  procedure(sub1), pointer :: subp => sub1

  contains

  subroutine sub1
    v=v+1
  end subroutine

end module

module b
  use a
  procedure(sub1), pointer :: subp2 => sub1

end module

The compiler accepts the procedure pointer subp, but gives an error for subp2:

$ nvfortran bug_procedure_pointer.f90 
NVFORTRAN-S-0084-Illegal use of symbol sub1 - attempt to use a SUBROUTINE as a FUNCTION (bug_procedure_pointer.f90: 16)
NVFORTRAN-S-0457-Illegal expression in initialization (bug_procedure_pointer.f90: 16)
  0 inform,   0 warnings,   2 severes, 0 fatal for b

Apologies for the late response. I missed updating the forum after were able to reproduce and determine that this is a compiler issue. I added a problem report, TPR #29015, and sent it engineering for further investigation.

-Mat

This issue was fixed in our 20.11 release.