Issue 175890
Summary [Flang] Should semantics validate KIND parameters against target characteristics for PDTs?
Labels flang
Assignees
Reporter Saieiei
    I'm working on fixing a bug where Flang accepts invalid KIND values in Parameterized Derived Types (PDT) that aren't supported by the target architecture (e.g., `TYPE(t(2))` with KIND=2 for REAL on x86-64).

I noticed the comment in `type-kinds.h` for `IsValidKindOfIntrinsicType()`:

> "A predicate that is true when a kind value is a kind that could possibly be supported for an intrinsic type category on some target instruction set architecture."

**My question:** Does this comment mean that Flang intentionally accepts KIND values like 1, 2, or 3 during semantic analysis, even when the target doesn't support them, because Flang is built to *potentially* support those KINDs on other architectures (e.g., KIND=2/FP16 on GPUs)?

In other words:

- Should I reject `TYPE(t(2))` during semantics when compiling for x86-64 (which doesn't support `REAL(KIND=2)`)?
- Or should I accept it during semantics and let the backend/lowering handle the error later?

Currently, `IsValidKindOfIntrinsicType()` returns `true` for KIND=2, but the target characteristics system shows it's unsupported on x86-64. I'm trying to understand the design intent before implementing a fix.

Thanks!

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to