[flang-commits] [flang] [llvm] [Flang] [OpenMP] Add semantic checks for detach clause in task (PR #119172)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Wed Dec 11 06:18:50 PST 2024
================
@@ -3711,6 +3768,30 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Linear &x) {
x.v.u);
}
+void OmpStructureChecker::Enter(const parser::OmpClause::Detach &x) {
+ // OpenMP 5.0: Task construct restrictions
+ CheckAllowedClause(llvm::omp::Clause::OMPC_detach);
+
+ // OpenMP 5.2: Detach clause restrictions
+ CheckIsVarPartOfAnotherVar(GetContext().clauseSource, x.v.v, "DETACH");
+ if (const auto *name{parser::Unwrap<parser::Name>(x.v.v)}) {
+ if (name->symbol) {
+ if (IsPointer(*name->symbol)) {
+ context_.Say(GetContext().clauseSource,
+ "The event-handle: `%s` must not have the POINTER attribute"_err_en_US,
+ name->ToString());
+ }
+ }
+ auto type{name->symbol->GetType()};
+ if (!name->symbol->GetType()->IsNumeric(TypeCategory::Integer) ||
+ evaluate::ToInt64(type->numericTypeSpec().kind()) != 8) {
----------------
kparzysz wrote:
We don't have a way of checking this, unfortunately. In other cases we limit it to checking that it has an INTEGER type, but without checking the kind.
https://github.com/llvm/llvm-project/pull/119172
More information about the flang-commits
mailing list