- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Example:
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
Default:
> ifort test.f -o test
> ./test
I= 10
entry 1
ic= 10
entry 2
ic= 0
Debug:
> ifort -g test.f -o test
> ./test
I= 10
entry 1
ic= 10
entry 2
ic= 10
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.
Thanks.
(ifort (IFORT) 19.1.0.166 20191121)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for explanation.
![](/skins/images/45C6C2D737ED71F4C51F0145C8CB1E9C/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page