Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29386 Discussions

Penalty associated with the use of allocatable arrays in derived types

OP1
New Contributor III
605 Views

Steve,

A month or so ago there was a thread about using allocatable arrays in derived types (click here). In one of your contributions to this thread you said: "In the case of allocatable or pointer array components of derived type, a temporary may be made."
My code makes a heavy use of allocatable arrays within nested derived types, due to a fairly complex set of input data. I have for instance allocatable arrays of derived-type variables, which in turn also have derived type components. A simple example would be A(i)%B(C(j)%D(k)) = p, for instance.

Can you elaborate a bit more on the "may" in your answer? Also, does the /check:arg_temp_created run-time option work for derived type structures?

Is a temporary only created when some part of the derived type variable is assigned a value? If I only use the derived type variable as an input, would a temporary be created?

Thanks,

Olivier

0 Kudos
1 Reply
Steven_L_Intel1
Employee
605 Views
The temporary copy might be made if you assign a value to one of these array components. I don't think I can list all the cases where this can happen, and I also don't think that /check:arg_temp_created will identify these.
0 Kudos
Reply