Skip to content

Commit

Permalink
[flang] Disallow BOZ literal constants as arguments of implicit inter…
Browse files Browse the repository at this point in the history
…faces

Since BOZ literal arguments are typeless, we cannot know how to pass them as
actual arguments to procedures with implicit interfaces.  This change avoids
the problem by emitting an error message in such situations.

This change stemmed from the following issue --
  #794

Differential Revision: https://reviews.llvm.org/D106831
  • Loading branch information
psteinfeld authored and jeanPerier committed Oct 22, 2021
1 parent 3b376b5 commit c37de10
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion flang/lib/Semantics/check-call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void CheckImplicitInterfaceArg(
}
}
if (const auto *expr{arg.UnwrapExpr()}) {
if (IsBOZLiteral(*expr)) {
if (std::holds_alternative<evaluate::BOZLiteralConstant>(expr->u)) {
messages.Say("BOZ argument requires an explicit interface"_err_en_US);
} else if (evaluate::IsNullPointer(*expr)) {
messages.Say(
Expand Down
3 changes: 0 additions & 3 deletions flang/test/Semantics/boz-literal-constants.f90
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,4 @@ subroutine bozchecks

!ERROR: BOZ argument requires an explicit interface
call implictSub(Z'12345')

!ERROR: Output item must not be a BOZ literal constant
print "(Z18)", Z"76543210"
end subroutine

0 comments on commit c37de10

Please sign in to comment.