- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using IFC Version 7.0 Build 20021028Z on RH 7.2.
Here is the problem:
An allocatable array declared in an external subprogram then allocated in an internal subprogram is no longer allocated after the internal subprogram returns and the save attribute is used. Here is the test code:
SUBROUTINE W3WAVE(NSEAL)
INTEGER,INTENT(IN) :: NSEAL
!REAL, ALLOCATABLE :: HS(:) !OK
REAL, ALLOCATABLE, SAVE :: HS(:) !Not OK
CALL W3INIT
PRINT*,'IN W3WAVE AFTER W3INIT: ' &
,ALLOCATED(HS),SIZE(HS)
RETURN
CONTAINS
SUBROUTINE W3INIT
ALLOCATE(HS(NSEAL))
PRINT*,'IN W3INIT: ' &
,ALLOCATED(HS),SIZE(HS)
RETURN
END SUBROUTINE W3INIT
END SUBROUTINE W3WAVE
PROGRAM W3SHEL
CALL W3WAVE(360)
END PROGRAM W3SHEL
Here is the output with the save attribute enabled:
IN W3INIT: T 360
IN W3WAVE AFTER W3INIT: F 0
Here is the output without the save attribute:
IN W3INIT: T 360
IN W3WAVE AFTER W3INIT: T 360
This test code works fine on other platforms / compilers -- indicating to me a problem with ifc. I welcome any helpful response.
Thanks,
TC
Here is the problem:
An allocatable array declared in an external subprogram then allocated in an internal subprogram is no longer allocated after the internal subprogram returns and the save attribute is used. Here is the test code:
SUBROUTINE W3WAVE(NSEAL)
INTEGER,INTENT(IN) :: NSEAL
!REAL, ALLOCATABLE :: HS(:) !OK
REAL, ALLOCATABLE, SAVE :: HS(:) !Not OK
CALL W3INIT
PRINT*,'IN W3WAVE AFTER W3INIT: ' &
,ALLOCATED(HS),SIZE(HS)
RETURN
CONTAINS
SUBROUTINE W3INIT
ALLOCATE(HS(NSEAL))
PRINT*,'IN W3INIT: ' &
,ALLOCATED(HS),SIZE(HS)
RETURN
END SUBROUTINE W3INIT
END SUBROUTINE W3WAVE
PROGRAM W3SHEL
CALL W3WAVE(360)
END PROGRAM W3SHEL
Here is the output with the save attribute enabled:
IN W3INIT: T 360
IN W3WAVE AFTER W3INIT: F 0
Here is the output without the save attribute:
IN W3INIT: T 360
IN W3WAVE AFTER W3INIT: T 360
This test code works fine on other platforms / compilers -- indicating to me a problem with ifc. I welcome any helpful response.
Thanks,
TC
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks like this is fixed in the current version 7.1.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the quick reply.
I'll check it out.
TC
I'll check it out.
TC

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page