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

Andre Kuhlenschmidt via flang-commits flang-commits at lists.llvm.org
Thu Apr 24 15:36:17 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)) {
----------------
akuhlens wrote:

You are correct, I was thinking that anytime the statement was initialize you would get an extra error message about having the save attribute, and that being distracting / misleading. Now that I think about it again and more generally, we would want to show both when the variable has an explicit save attribute and was initialized.

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


More information about the flang-commits mailing list