Skip to content

Commit 828bfbe

Browse files
authored
[flang] Suppress error meant to prevent discontiguous association whe… (#73175)
…n actual argument is contiguous When an element of a contiguous pointer array or assumed-shape array is associated as an actual argument with an assumed-size dummy array, don't flag the usage as an error.
1 parent fddadd2 commit 828bfbe

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

flang/lib/Semantics/check-call.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -529,17 +529,18 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
529529
dummyName);
530530
}
531531
if (actualIsArrayElement && actualLastSymbol &&
532-
IsPointer(*actualLastSymbol)) {
533-
basicError = true;
534-
messages.Say(
535-
"Element of pointer array may not be associated with a %s array"_err_en_US,
536-
dummyName);
537-
}
538-
if (actualLastSymbol && IsAssumedShape(*actualLastSymbol)) {
539-
basicError = true;
540-
messages.Say(
541-
"Element of assumed-shape array may not be associated with a %s array"_err_en_US,
542-
dummyName);
532+
!evaluate::IsContiguous(*actualLastSymbol, foldingContext)) {
533+
if (IsPointer(*actualLastSymbol)) {
534+
basicError = true;
535+
messages.Say(
536+
"Element of pointer array may not be associated with a %s array"_err_en_US,
537+
dummyName);
538+
} else if (IsAssumedShape(*actualLastSymbol)) {
539+
basicError = true;
540+
messages.Say(
541+
"Element of assumed-shape array may not be associated with a %s array"_err_en_US,
542+
dummyName);
543+
}
543544
}
544545
}
545546
}

0 commit comments

Comments
 (0)