Problem with submodules, when using the value attribute

when compiling the following code with -DWITH_VALUE

$ nvfortran problem.F90 -DWITH_VALUE
NVFORTRAN-S-0038-Symbol, input, has not been explicitly declared (problem.F90: 4)
0 inform, 0 warnings, 1 severes, 0 fatal for subroutine_017
[armnmfv@nemesis ~/GITHUB-ECCC/fortran_examples (main %|u=)] $ nvfortran --version

nvfortran 23.1-0 64-bit target on x86-64 Linux -tp zen3
NVIDIA Compilers and Tools
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

module module_017
implicit none
interface
module subroutine subroutine_017(input, output) ! interface defined here, boy will be found in a submodule
implicit none
#if defined(WITH_VALUE)
integer, intent(IN), value :: input ! the value clause generates an error with some compilers (nvfortran)
#else
integer, intent(IN) :: input
#endif
integer, intent(OUT) :: output
end
end interface
end module
submodule (module_017) submodule_017 ! submodule whose parent is module_017
contains
module procedure subroutine_017 ! must not duplicate the inferface, already defined in module module_017
implicit none ! subroutine body here
output = input
print *,‘subroutine_017 : input =’, input
end
end submodule
program demo_017
use module_017
implicit none
integer :: output
call subroutine_017(456, output)
print *, 'program demo_017 : value = ',output
end

without the value attribute :
$ nvfortran problem.F90 && ./a.out
subroutine_017 : input = 456
program demo_017 : value = 456

if implicit none in the submodule is removed, no error is reported

Thanks for the report mfvalin,

I was able to reproduce the issue here and have filed a problem report, TPR #33156. We’ll have our engineers investigate.

-Mat

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

% nvfortran problem.F90 -DWITH_VALUE -V24.1
% a.out
 subroutine_017 : input =          456
 program demo_017 : value =           456

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.