Problem with Fortran compiler 23.9

module nv_by_value
    implicit none
    interface
        module subroutine print_val(val)
            implicit none
            integer, intent(in), value :: val  ! <-- Compilation error
        end subroutine
    end interface
end module
submodule(nv_by_value) nv_submodule
    contains
        module procedure print_val
            implicit none   ! <-- Compilation error
            print *, 'val = ', val
        end procedure
end submodule

nvfortran -c nvidia_bug_001.F90
NVFORTRAN-S-0038-Symbol, val, has not been explicitly declared (nvidia_bug_001.F90: 4)
0 inform, 0 warnings, 1 severes, 0 fatal for print_val
removing the value clause or the flagged implicit none
allows compilation without error

Thanks mfvalin,

I’ve created a problem report, TPR #34428, and sent it to engineering for review.

As a workaround, you can fully specify the interface of the module subroutine in the submodule for print_val. For example:

module nv_by_value
    implicit none
    interface
        module subroutine print_val(val)
            implicit none
            integer, intent(in), value :: val
        end subroutine
    end interface
end module
submodule(nv_by_value) nv_submodule
    contains`
        module subroutine print_val(val)
          implicit none 
            integer, intent(in), value :: val
           print *, 'val = ', val
       end subroutine
end submodule
use nv_by_value
call print_val(100)
end

-Mat

thanks, this looks like a usable way to get around the problem

FYI, TPR #34428 should be fixed in our 24.1 release.

Fails in 23.11:

% nvfortran -V23.11 -c test.F90
NVFORTRAN-S-0038-Symbol, val, has not been explicitly declared (test.F90: 4)
  0 inform,   0 warnings,   1 severes, 0 fatal for print_val

Compiles with 24.1:

% nvfortran -V24.1 -c test.F90
%