[flang-commits] [flang] [flang] fix scoping of cray pointer declarations and add check for initialization (PR #136776)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Tue Apr 22 16:15:06 PDT 2025


================
@@ -963,7 +963,17 @@ void CheckHelper::CheckObjectEntity(
         "'%s' is a data object and may not be EXTERNAL"_err_en_US,
         symbol.name());
   }
-
+  if (symbol.test(Symbol::Flag::CrayPointee)) {
+    // NB, IsSaved was too smart here.
+    if (details.init()) {
+      messages_.Say(
+          "Cray pointee '%s' may not be initialized"_err_en_US, symbol.name());
+    } else if (symbol.attrs().test(Attr::SAVE) ||
+        symbol.implicitAttrs().test(Attr::SAVE)) {
----------------
klausler wrote:

`implicitAttrs()` is always a subset of `attrs()` so you don't need to redundantly check it.

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


More information about the flang-commits mailing list