This is an archive of the discontinued LLVM Phabricator instance.

[flang] Support SELECT RANK on allocatables & pointers
ClosedPublic

Authored by klausler on Aug 28 2023, 5:16 PM.

Details

Summary

Unlike other executable constructs with associating selectors, the
selector of a SELECT RANK construct can have the ALLOCATABLE or POINTER
attribute, and will work as an allocatable or object pointer within
each rank case, so long as there is no RANK(*) case.

Getting this right exposed a correctness risk with the popular
predicate IsAllocatableOrPointer() -- it will be true for procedure
pointers as well as object pointers, and in many contexts, a procedure
pointer should not be acceptable. So this patch adds the new predicate
IsAllocatableOrObjectPointer(), and updates some call sites of the original
function to use the new one.

Diff Detail

Event Timeline

klausler created this revision.Aug 28 2023, 5:16 PM
klausler requested review of this revision.Aug 28 2023, 5:16 PM
vzakhari accepted this revision.Aug 28 2023, 6:01 PM

Thank you! Looks great!

This revision is now accepted and ready to land.Aug 28 2023, 6:01 PM
klausler updated this revision to Diff 554315.Aug 29 2023, 7:08 AM

Try another version of clang-format.

This revision was landed with ongoing or failed builds.Aug 29 2023, 2:56 PM
This revision was automatically updated to reflect the committed changes.