Skip to content

[flang] Don't accept NULL() actual for assumed-rank dummy #71574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions flang/docs/Extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ end
non-global name in the same scope. This is not conforming,
but it is useful and unambiguous.
* The argument to `RANDOM_NUMBER` may not be an assumed-size array.
* `NULL()` without `MOLD=` is not allowed to be associated as an
actual argument corresponding to an assumed-rank dummy argument;
its rank in the called procedure would not be well-defined.

## Extensions, deletions, and legacy features supported by default

Expand Down
4 changes: 4 additions & 0 deletions flang/lib/Semantics/check-call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,10 @@ static void CheckExplicitInterfaceArg(evaluate::ActualArgument &arg,
} else if (object.type.type().IsTypelessIntrinsicArgument() &&
evaluate::IsNullObjectPointer(*expr)) {
// ok, ASSOCIATED(NULL(without MOLD=))
} else if (object.type.attrs().test(characteristics::
TypeAndShape::Attr::AssumedRank)) {
messages.Say(
"NULL() without MOLD= must not be associated with an assumed-rank dummy argument"_err_en_US);
} else if ((object.attrs.test(characteristics::DummyDataObject::
Attr::Pointer) ||
object.attrs.test(characteristics::
Expand Down
4 changes: 4 additions & 0 deletions flang/test/Semantics/call39.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ subroutine test
call s1(null(a1)) ! ok
call sa(null(a0)) ! ok
call sa(null(a1)) ! ok
!ERROR: NULL() without MOLD= must not be associated with an assumed-rank dummy argument
call sa(null())
!ERROR: NULL() without MOLD= must not be associated with an assumed-rank dummy argument
call sa(null())
end
end