@@ -463,22 +463,27 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
463
463
: nullptr };
464
464
int actualRank{actualType.Rank ()};
465
465
bool actualIsPointer{evaluate::IsObjectPointer (actual)};
466
+ bool actualIsAssumedRank{evaluate::IsAssumedRank (actual)};
466
467
if (dummy.type .attrs ().test (
467
468
characteristics::TypeAndShape::Attr::AssumedShape)) {
468
469
// 15.5.2.4(16)
469
- if (actualRank == 0 ) {
470
+ if (actualIsAssumedRank) {
471
+ messages.Say (
472
+ " Assumed-rank actual argument may not be associated with assumed-shape %s" _err_en_US,
473
+ dummyName);
474
+ } else if (actualRank == 0 ) {
470
475
messages.Say (
471
476
" Scalar actual argument may not be associated with assumed-shape %s" _err_en_US,
472
477
dummyName);
473
- }
474
- if (actualIsAssumedSize && actualLastSymbol) {
478
+ } else if (actualIsAssumedSize && actualLastSymbol) {
475
479
evaluate::SayWithDeclaration (messages, *actualLastSymbol,
476
480
" Assumed-size array may not be associated with assumed-shape %s" _err_en_US,
477
481
dummyName);
478
482
}
479
483
} else if (dummyRank > 0 ) {
480
484
bool basicError{false };
481
- if (actualRank == 0 && !dummyIsAllocatableOrPointer) {
485
+ if (actualRank == 0 && !actualIsAssumedRank &&
486
+ !dummyIsAllocatableOrPointer) {
482
487
// Actual is scalar, dummy is an array. F'2023 15.5.2.5p14
483
488
if (actualIsCoindexed) {
484
489
basicError = true ;
@@ -531,7 +536,7 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
531
536
characteristics::DummyDataObject::Attr::DeducedFromActual)) {
532
537
if (auto dummySize{evaluate::ToInt64 (evaluate::Fold (foldingContext,
533
538
evaluate::GetSize (evaluate::Shape{dummy.type .shape ()})))}) {
534
- if (actualRank == 0 ) {
539
+ if (actualRank == 0 && !actualIsAssumedRank ) {
535
540
if (evaluate::IsArrayElement (actual)) {
536
541
// Actual argument is a scalar array element
537
542
evaluate::DesignatorFolder folder{
@@ -568,7 +573,7 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
568
573
}
569
574
}
570
575
}
571
- } else { // actualRank > 0
576
+ } else { // actualRank > 0 || actualIsAssumedRank
572
577
if (auto actualSize{evaluate::ToInt64 (evaluate::Fold (foldingContext,
573
578
evaluate::GetSize (evaluate::Shape (actualType.shape ()))))};
574
579
actualSize && *actualSize < *dummySize) {
@@ -644,7 +649,7 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
644
649
" Coindexed ASYNCHRONOUS or VOLATILE actual argument may not be associated with %s with ASYNCHRONOUS or VOLATILE attributes unless VALUE" _err_en_US,
645
650
dummyName);
646
651
}
647
- if (actualRank > 0 && !actualIsContiguous) {
652
+ if (( actualRank > 0 || actualIsAssumedRank) && !actualIsContiguous) {
648
653
if (dummyIsContiguous ||
649
654
!(dummyIsAssumedShape || dummyIsAssumedRank ||
650
655
(actualIsPointer && dummyIsPointer))) { // C1539 & C1540
0 commit comments