diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp --- a/flang/lib/Semantics/check-call.cpp +++ b/flang/lib/Semantics/check-call.cpp @@ -417,6 +417,16 @@ } } + // technically legal but worth emitting a warning + // llvm-project issue #58973: constant actual argument passed in where dummy + // argument is marked volatile + if (dummyIsVolatile && IsConstantExpr(actual)) { + messages.Say( + "actual argument associated with VOLATILE dummy argument %s is not a variable"_warn_en_US, + dummyName); + } + //"actual argument associated with VOLATILE dummy argument %s is not a variable"_warn_en_US, dummyName); + // Cases when temporaries might be needed but must not be permitted. bool actualIsContiguous{IsSimplyContiguous(actual, context)}; bool dummyIsAssumedShape{dummy.type.attrs().test(