[flang-commits] [flang] [flang][acc] Check that atomic variables are of intrinsic type (PR #230197)

Razvan Lupusoru via flang-commits flang-commits at lists.llvm.org
Fri Oct 9 11:51:54 PDT 2026


================
@@ -812,17 +812,29 @@ void AccStructureChecker::CheckAtomicStmt(
 
   if (lhs) {
     if (lhs->Rank() != 0) {
-      context_.Say(expr.source,
+      context_.Say(var.GetSource(),
           "LHS of atomic %s statement must be scalar"_err_en_US, construct);
     }
-    // TODO: Check if lhs is intrinsic type.
+    // Restriction - atomic variables must be of intrinsic type.
+    if (const auto type{lhs->GetType()};
+        type && type->category() == TypeCategory::Derived) {
----------------
razvanlupusoru wrote:

So being "intrinsic" type and issuing error when it is NOT "derived" is not semantically equivalent (although this holds true today and likely will hold). But I wonder if it is better to be explicit. Would calling `isValidKindOfIntrinsicType` work here? @eugeneepshteyn 

https://github.com/llvm/llvm-project/pull/230197


More information about the flang-commits mailing list