aboutsummaryrefslogtreecommitdiff
path: root/flang/runtime/derived.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang/runtime/derived.cpp')
-rw-r--r--flang/runtime/derived.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/flang/runtime/derived.cpp b/flang/runtime/derived.cpp
index 7c164ff..10813c6 100644
--- a/flang/runtime/derived.cpp
+++ b/flang/runtime/derived.cpp
@@ -129,6 +129,10 @@ RT_API_ATTRS int InitializeClone(const Descriptor &clone,
std::size_t elements{orig.Elements()};
int stat{StatOk};
+ // Skip pointers and unallocated variables.
+ if (orig.IsPointer() || !orig.IsAllocated()) {
+ return stat;
+ }
// Initialize each data component.
std::size_t components{componentDesc.Elements()};
for (std::size_t i{0}; i < components; ++i) {