Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions flang-rt/lib/runtime/pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ void RTDEF(PointerAssociateScalar)(Descriptor &pointer, void *target) {
}

void RTDEF(PointerAssociate)(Descriptor &pointer, const Descriptor &target) {
pointer = target;
pointer.raw().attribute = CFI_attribute_pointer;
if (target.ElementBytes() > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would leave the pointer unchanged when the target is an empty storage sequence, which would be wrong.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. The pointer object will still need to get the dynamic type and etc from the target even though it's association status is not associated with the zero-sized storage sequence.

// F2023, 16.9.20, p5, case (v)-(vi): don't associate pointers with
// targets that have zero sized storage sequence.
pointer = target;
pointer.raw().attribute = CFI_attribute_pointer;
}
}

void RTDEF(PointerAssociateLowerBounds)(Descriptor &pointer,
Expand Down
Loading