[flang-commits] [flang] [flang] Diagnose assumed-type statement function dummy arguments (PR #227694)
Shrisha Kumar via flang-commits
flang-commits at lists.llvm.org
Wed Oct 14 02:15:40 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())) {
----------------
Shrisha4real wrote:
You are right. `DynamicType::IsNonConstantLengthCharacter()` at `flang/lib/Evaluate/type.cpp:242` is the method with the same implementation. I have pushed another commit https://github.com/llvm/llvm-project/pull/227694/commits/89f39991caca4868f78585ecdeba44c0cdbd1488 with this fix
https://github.com/llvm/llvm-project/pull/227694
More information about the flang-commits
mailing list