Hi
I get an access violation when I try to copy one extended structure to another:
"forrtl: severe (157): Program Exception - access violation"
If I use ordinary "types", then this works fine.
Am I not allowed to copy one extended type to another? Is there are workaround?
I am using the Intel Visual Fortran Compiler v. 16.0.
program Console1 implicit none ! Variables integer, parameter :: DP=8 integer, parameter :: MAXNAMELENGTH=10 !-- BASIC TYPE type :: T_BASIC(n) integer, len :: n=MAXNAMELENGTH !length of nam (defaults to MAXNAMELENGTH) character(len=n) :: nam !name integer :: iPoi !internal pointer end type T_BASIC !-- beam appurtenance properties type, extends(T_BASIC) :: T_prtapp !<- **** this will lead to trouble **** ! type :: T_prtapp !<- **** this will work **** integer :: Tp end type T_prtapp !-- beam appurtenances (actual appurtenances as used) type :: T_bapp type (T_prtapp) :: prt !appurtenance properties for this beam appurtenance end type T_bapp !-- Global data type :: T_G type(T_prtapp), dimension(:), allocatable :: prtapp !appurtenance properties integer :: nprtapp !number of appurtenance properties type(T_bapp), dimension(:), allocatable :: Bapp !beam appurtenances integer :: nBApp !number of beam appurtenances end type T_G type(T_G) :: G integer :: iret ! Body of Console1 G%nprtapp = 5 allocate(G%prtapp(G%nprtapp)) G%nBapp = 3 allocate(G%Bapp(G%nBapp)) G%Bapp(1)%prt = G%prtapp(1) !<- this throws the error iret = 1 end program Console1
Best regards
Lars