I know that ENTRY is obsolete but in my case it is the fastest way to accommodate old code to my purpose.
I expected that I can share variables between all ENTRYs. But I find strange difference.
program test integer :: i i=10 WRITE(*,*) 'I=',i call atest() call a1(i) call a2() end program subroutine atest() INTEGER :: ic return entry a1(i) ic=i WRITE(*,*) 'entry 1' WRITE(*,*) 'ic=',ic return entry a2() WRITE(*,*) 'entry 2' WRITE(*,*) 'ic=',ic end subroutine
> ifort test.f -o test
> ifort -g test.f -o test
So, by default my common variable 'ic' is invisible to other entries, but not in debug mode.
Which one is correct ? I expected that debug mode is more correct.
(ifort (IFORT) 22.214.171.124 20191121)
"ic" is not a "common variable - it is a local and is undefined when coming in through a2. You'll need to add the SAVE attribute to ic if you want this to work.
The debugger has limited information about variables and, especially in cases such as this, may get it wrong.