It's possible to declare an external procedure with an implicit interface and
then pass it as an actual argument to a subprogram expecting a procedure
argument. I added tests for this and added an error message to distinguish
passing an actual argument with an implicit interface from passing an argument
with a mismatched explicit interface.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
If a dummy procedure has an explicit interface, the actual procedure must conform to it (15.5.2.9 paragraph 1). Do your changes allow a actual procedure with an implicit interface to be associated with a dummy procedure with an explicit interface?
My changes allow a procedure declared as "external :: func" to be passed to a procedure dummy argument with an explicit interface. This construct is allowed by pgf90, GNU, IBM, Intel, and NAG. I've implemented this by checking "HasExplicitInterface()" on the characteristics of the actual argument.
I'm not sure how to think about all of this. Does the standard require that a compiler reject a program when the compiler cannot verify at compile time if the characteristics are the same? Are these other compilers not properly enforcing the standard?
I'll investigate other ways to declare procedures with implicit interfaces to see if my implementation is too broad.
flang/lib/Semantics/check-call.cpp | ||
---|---|---|
552 | "which is not known to be compatible with" might be better. |
flang/lib/Semantics/check-call.cpp | ||
---|---|---|
552 | Good suggestion. I'll do it. |
"which is not known to be compatible with" might be better.