[flang-commits] [flang] [flang] Diagnose assumed-type statement function dummy arguments (PR #227694)
Yusuke MINATO via flang-commits
flang-commits at lists.llvm.org
Wed Oct 14 00:51:55 PDT 2026
================
@@ -1704,6 +1701,28 @@ void CheckHelper::CheckSubprogram(
*host);
}
}
+ // F2023 15.6.4: the length of a CHARACTER statement function result or
+ // dummy argument shall be a constant specification expression.
+ auto checkCharLength{[&](const Symbol &entity, const char *what) {
+ if (const DeclTypeSpec * type{entity.GetType()};
+ type && type->category() == DeclTypeSpec::Character) {
+ const ParamValue &length{type->characterTypeSpec().length()};
+ if (length.isExplicit() && length.GetExplicit() &&
+ !evaluate::IsConstantExpr(*length.GetExplicit())) {
----------------
yus3710-fj wrote:
I'm not familiar with the implementation of semantics, but is there already something similar? If not, I think it might be better to extract this into a separate function so we can easily reuse it.
https://github.com/llvm/llvm-project/pull/227694
More information about the flang-commits
mailing list