allocate in internal subprogram

allocate in internal subprogram

Bild des Benutzers tjcamp

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

3 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Steve Lionel (Intel)

Looks like this is fixed in the current version 7.1.

Steve

Steve
Bild des Benutzers tjcamp

Thanks for the quick reply.
I'll check it out.
TC

Melden Sie sich an, um einen Kommentar zu hinterlassen.