@@ -1129,20 +1129,20 @@ static void CheckExplicitInterfaceArg(evaluate::ActualArgument &arg,
1129
1129
}
1130
1130
auto restorer{
1131
1131
messages.SetLocation (arg.sourceLocation ().value_or (messages.at ()))};
1132
- auto checkActualArgForLabel = [&](evaluate::ActualArgument &arg) {
1132
+ auto CheckActualArgForLabel = [&](evaluate::ActualArgument &arg) {
1133
1133
if (arg.isAlternateReturn ()) {
1134
1134
messages.Say (
1135
1135
" Alternate return label '%d' cannot be associated with %s" _err_en_US,
1136
1136
arg.GetLabel (), dummyName);
1137
- return true ;
1138
- } else {
1139
1137
return false ;
1138
+ } else {
1139
+ return true ;
1140
1140
}
1141
1141
};
1142
1142
common::visit (
1143
1143
common::visitors{
1144
1144
[&](const characteristics::DummyDataObject &object) {
1145
- if (! checkActualArgForLabel (arg)) {
1145
+ if (CheckActualArgForLabel (arg)) {
1146
1146
ConvertBOZLiteralArg (arg, object.type .type ());
1147
1147
if (auto *expr{arg.UnwrapExpr ()}) {
1148
1148
if (auto type{characteristics::TypeAndShape::Characterize (
@@ -1160,9 +1160,16 @@ static void CheckExplicitInterfaceArg(evaluate::ActualArgument &arg,
1160
1160
evaluate::IsNullObjectPointer (*expr)) {
1161
1161
// ok, ASSOCIATED(NULL(without MOLD=))
1162
1162
} else if (object.type .attrs ().test (characteristics::
1163
- TypeAndShape::Attr::AssumedRank)) {
1163
+ TypeAndShape::Attr::AssumedRank) &&
1164
+ evaluate::IsNullObjectPointer (*expr) &&
1165
+ (object.attrs .test (
1166
+ characteristics::DummyDataObject::Attr::Allocatable) ||
1167
+ object.attrs .test (
1168
+ characteristics::DummyDataObject::Attr::Pointer) ||
1169
+ !object.attrs .test (characteristics::DummyDataObject::
1170
+ Attr::Optional))) {
1164
1171
messages.Say (
1165
- " NULL() without MOLD= must not be associated with an assumed-rank dummy argument" _err_en_US);
1172
+ " NULL() without MOLD= must not be associated with an assumed-rank dummy argument that is ALLOCATABLE, POINTER, or non-OPTIONAL " _err_en_US);
1166
1173
} else if ((object.attrs .test (characteristics::DummyDataObject::
1167
1174
Attr::Pointer) ||
1168
1175
object.attrs .test (characteristics::
@@ -1223,7 +1230,7 @@ static void CheckExplicitInterfaceArg(evaluate::ActualArgument &arg,
1223
1230
}
1224
1231
},
1225
1232
[&](const characteristics::DummyProcedure &dummy) {
1226
- if (! checkActualArgForLabel (arg)) {
1233
+ if (CheckActualArgForLabel (arg)) {
1227
1234
CheckProcedureArg (arg, proc, dummy, dummyName, context,
1228
1235
ignoreImplicitVsExplicit);
1229
1236
}
0 commit comments