Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Catching allocation errors when duplicating derived type structures

OP1
New Contributor III
339 Views
Is there a way to catch a potential memory allocation error when using the statement A = B, where A and Bare an allocatable, derived-type variable which has allocatable array components?

....

! Declare A and B.
TYPE MY_TYPE
REAL(KIND=8),ALLOCATABLE :: X(:,:)
END TYPE MY_TYPE
TYPE(MY_TYPE),ALLOCATABLE :: A(:),B(:)

! Theautomatic allocations performed implicitly herein might fail...
A = B

....

Or should I go through the minutiae of allocating one by one all of the array components?

Thanks,

Olivier
0 Kudos
1 Reply
Steven_L_Intel1
Employee
339 Views

If you want to catch the errors you will have to handle all of the ALLOCATEs yourself.
0 Kudos
Reply