Skip to content

Commit 313b52f

Browse files
[flang] Don't associate pointers with zero sized storage targets (#155867)
Fixes #155481
1 parent 5af5c3a commit 313b52f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flang-rt/lib/runtime/pointer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ bool RTDEF(PointerIsAssociatedWith)(
267267
if (!target) {
268268
return pointer.raw().base_addr != nullptr;
269269
}
270-
if (!target->raw().base_addr ||
271-
(target->raw().type != CFI_type_struct && target->ElementBytes() == 0)) {
270+
if (!target->raw().base_addr || target->ElementBytes() == 0 ||
271+
target->Elements() == 0) {
272+
// F2023, 16.9.20, p5, case (v)-(vi): don't associate pointers with
273+
// targets that have zero sized storage sequence.
272274
return false;
273275
}
274276
int rank{pointer.rank()};

0 commit comments

Comments
 (0)