[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
================
@@ -8052,7 +8052,7 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
// Map standard OpenMP foreign-runtime identifier strings to
// their well-known integer values (OpenMP 5.1, Table 22.2).
auto frId = llvm::StringSwitch<std::optional<int64_t>>(
- llvm::StringRef(*str).lower())
+ str->AsStringRef()->lower())
----------------
eugeneepshteyn wrote:
(This comment was generated with the help of AI)
`GetScalarConstantValue<Ascii>` now matches CHARACTER kinds 2 and 4 as well, but `AsStringRef()` is empty for them, so this dereferences an empty optional:
```fortran
subroutine s(obj)
integer(8) :: obj
!$omp interop init(prefer_type(4_"cuda"), targetsync: obj)
end subroutine
```
With `-fopenmp -fopenmp-version=60` the base compiler reports "not yet implemented: non-constant prefer_type value in interop init"; this aborts (and is undefined behavior without libstdc++ assertions). `2_"cuda"` behaves the same. Please keep the kind-1 restriction here and add a test for both wider kinds. The `genErrorDirective` change below has the same shape: a non-default-kind message would be dropped rather than taking the `messageExpr` path (semantics rejects that today).
https://github.com/llvm/llvm-project/pull/216960
More information about the flang-commits
mailing list