This is identical to the problem reported here, which I shall copy and paste:
module entry_testing_m
implicit none
private
public :: foo, bar
contains
subroutine foo()
integer :: x, y, z
logical :: came_from_foo
came_from_foo = .true.
print *, 'came from foo'
x = 1
y = 2
entry bar()
if (.not. came_from_foo) then
print *, 'came from bar'
x = 1000
y = 2000
end if
z = x + y
print *, z
end subroutine foo
end module entry_testing_m
program main_testing
use entry_testing_m, only: foo, bar
implicit none
print *, 'testing foo'
call foo()
print *, 'testing bar'
call bar()
end program main_testing
Compiling with nvfortran gives the error:
nvfortran -c -g -O0 -o entry_testing.o entry_testing.f90
NVFORTRAN-W-0155-MODULE PROCEDURE not defined: bar (entry_testing.f90: 25)
0 inform, 1 warnings, 0 severes, 0 fatal for foo
nvfortran -c -g -O0 -o main_testing.o main_testing.f90
NVFORTRAN-S-0084-Illegal use of symbol bar - attempt to CALL a non-SUBROUTINE (main_testing.f90: 8)
0 inform, 0 warnings, 1 severes, 0 fatal for main_testing
make: *** [Makefile:18: main_testing.o] Error 2
The program compiles succesfully if you change
PRIVATE
PUBLIC :: whatever_you_want_to_be_public, ...
to
PUBLIC
PRIVATE :: whater_you_want_to_be_private, ...
One of the replies says
…the behavior of using entry inside a module is undefined.
I’ve had a look at the Fortran standard and I believe this is not the case. Table 5.2 says that entry statements are allowed in module subprograms.
I think this should be regarded as a bug in nvfortran.