[flang-commits] [PATCH] D121603: [flang] fulfill -Msave/-fno-automatic in main programs too

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Mar 15 01:34:39 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG83b0d0f964c0: [flang] fulfill -Msave/-fno-automatic in main programs too (authored by jeanPerier).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121603/new/

https://reviews.llvm.org/D121603

Files:
  flang/lib/Evaluate/tools.cpp


Index: flang/lib/Evaluate/tools.cpp
===================================================================
--- flang/lib/Evaluate/tools.cpp
+++ flang/lib/Evaluate/tools.cpp
@@ -1324,12 +1324,14 @@
     // BLOCK DATA entities must all be in COMMON,
     // which was checked above.
     return true;
-  } else if (scope.kind() == Scope::Kind::Subprogram &&
-      scope.context().languageFeatures().IsEnabled(
-          common::LanguageFeature::DefaultSave) &&
-      !(scope.symbol() && scope.symbol()->attrs().test(Attr::RECURSIVE))) {
-    // -fno-automatic/-save/-Msave option applies to objects in
-    // executable subprograms unless they are explicitly RECURSIVE.
+  } else if (scope.context().languageFeatures().IsEnabled(
+                 common::LanguageFeature::DefaultSave) &&
+      (scopeKind == Scope::Kind::MainProgram ||
+          (scope.kind() == Scope::Kind::Subprogram &&
+              !(scope.symbol() &&
+                  scope.symbol()->attrs().test(Attr::RECURSIVE))))) {
+    // -fno-automatic/-save/-Msave option applies to all objects in executable
+    // main programs and subprograms unless they are explicitly RECURSIVE.
     return true;
   } else if (symbol.test(Symbol::Flag::InDataStmt)) {
     return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121603.415356.patch
Type: text/x-patch
Size: 1245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220315/8e856e3b/attachment.bin>


More information about the flang-commits mailing list