[flang-commits] [flang] [llvm] [Flang] KIND De-templatization (PR #216960)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Wed Oct 21 15:53:53 PDT 2026
================
@@ -1033,9 +1034,9 @@ MaybeExpr ExpressionAnalyzer::Analyze(const parser::LogicalLiteralConstant &x) {
auto kind{AnalyzeKindParam(std::get<std::optional<parser::KindParam>>(x.t),
GetDefaultKind(TypeCategory::Logical))};
bool value{std::get<bool>(x.t)};
- auto result{common::SearchTypes(
- TypeKindVisitor<TypeCategory::Logical, Constant, bool>{
- kind, std::move(value)})};
+ auto result{SearchTypes(
+ TypeKindVisitor<TypeCategory::Logical, Constant, value::LogicalValue>{
+ kind, value::LogicalValue{kind, value}})};
----------------
eugeneepshteyn wrote:
(This comment was generated with the help of AI)
The `LogicalValue` is now constructed before `SearchTypes` has validated the kind, so an unsupported kind crashes in `IntegerValue` ("fatal internal error: unsupported integer width") instead of being diagnosed as "unsupported LOGICAL(KIND=n)":
```fortran
logical :: x = .true._5
end
```
PDT instantiation reaches it too:
```fortran
type t(k)
integer, kind :: k
logical(k) :: x = .true._k
end type
type(t(5)) :: v
end
```
`Semantics/kinds02.f90` covers exactly this, but it never runs: its `REQUIRES: x86_64-registered-target` names a feature lit does not define (lit defines `x86-registered-target`), and the same is true of `kinds01.f90`.
https://github.com/llvm/llvm-project/pull/216960
More information about the flang-commits
mailing list