This is an archive of the discontinued LLVM Phabricator instance.

[flang] handle allocatable components when creating array temps
ClosedPublic

Authored by jeanPerier on Mar 17 2022, 2:03 AM.

Details

Summary

When creating an array temporary in the array copy pass, care must be
taken with allocatable components. The element components needs to be
given a clean unallocated status before being used in the assignments.
This is because assignment of allocatable components makes deep copy,
and may cause deallocation of the previous value if it was allocated.
Hence the previous allocation status cannot be let undefined.

On top of that, when cleaning-up the temp, all allocatable components
that may have been allocated must be deallocated.

This patch implements this by centralizing the code making and cleaning
array temps in ArrayValueCopy.cpp, and by calling Initialize and Destroy
runtime entry points when they are allocatable components.

Diff Detail

Event Timeline

jeanPerier created this revision.Mar 17 2022, 2:03 AM
Herald added a project: Restricted Project. · View Herald Transcript
jeanPerier requested review of this revision.Mar 17 2022, 2:03 AM
This revision is now accepted and ready to land.Mar 17 2022, 2:15 AM