[flang-commits] [flang] [Flang] Diagnose DATA on PDT instance components as unimplemented (PR #213598)
via flang-commits
flang-commits at lists.llvm.org
Tue Oct 6 05:07:48 PDT 2026
ejose02 wrote:
More context for the patch:
Root cause
- DataVarChecker::operator()(const Symbol &) rejects DATA when IsAutomatic(symbol) is true.
- evaluate::IsAutomatic() returns true if explicit character length is not a constant expression.
- PDT instantiation keeps character(len=<length type parameter>) unfolded on purpose so the component stays descriptor/automatic elsewhere, even when the actual is constant (e.g. ut(1)).
Fix
- Early in DataVarChecker::operator()(const Symbol &), if IsAutomatic(symbol) and symbol.owner().IsParameterizedDerivedTypeInstantiation(), emit _todo_en_US and return false (before the "Automatic variable" branch).
- Applies to any component symbol in a PDT instantiation scope that IsAutomatic flags, not only CHARACTER (the issue reproducer is character).
```
if (IsAutomatic(symbol) &&
symbol.owner().IsParameterizedDerivedTypeInstantiation()) {
context_.Say(source_,
"DATA statement initialization of a component in a parameterized derived type instance"_todo_en_US);
return false;
}
```
https://github.com/llvm/llvm-project/pull/213598
More information about the flang-commits
mailing list