Using Intel Visual Fortran XE 2013 (with 2003 syntax enabled) and Visual Studio 2012
I have a derived type with an allocatable array as a component. When I try to allocate an the array or set the allocatable array equal to an array, it doesn't seem to work. There is no error, but the values don't seem to be present.
Below is an example that should illustrate the issue.
Type myType
integer :: var1, var2
real*8,dimension(:), allocatable :: listOfReals
integer, dimension(:), allocatable :: listOfInts
end Type myType
function setTheValues(someParams) result(typeA)
type(params_T), intent(in) :: someParams
type(myType_T) :: typeA
type(lists_t) :: lists
typeA%var1 = 1
typeA%var2 = 2
!where getList is a function that returns an
!object with an array of real numbers and an array of ints
lists = getLists(someParams)
typeA%listOfReals = lists%reals
typeA%listOfInts = lists%ints
end function setTheValues
this doesn't work. neither does:
function setTheValues(someParams) result(typeA)
type(params_T), intent(in) :: someParams
type(myType_T) :: typeA
type(lists_t) :: lists
typeA%var1 = 1
typeA%var2 = 2
allocate(typeA%listOfReals(12))
allocate(typeA%listOfInts(12))
!where getList is a function that returns an
!derivedtype with an array of real numbers and an array of ints both of size 12
lists = getLists(someParams)
typeA%listOfReals = lists%reals
typeA%listOfInts = lists%ints
end function setTheValues
I either get something saying the values are not present, it won't show me any values, or it gives me an array with what appear to be enormous random index values with bad data.
Any help would be greatly appreciated.
EDIT: I am doing similar things in other parts of the code and they seem to be working right even though the debugger still seems to be having problems displaying the values right.
assume realloc_lhs? Beyond that, can you give a more complete example, in particular, what says "the values are not present"? - francescalus