[flang-commits] [PATCH] D114209: [flang] Add -fno-automatic, refine IsSaved()

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Nov 19 09:18:22 PST 2021


klausler marked an inline comment as done.
klausler added inline comments.


================
Comment at: flang/lib/Evaluate/tools.cpp:1203
+  } else if (scopeKind == Scope::Kind::Module ||
+      scopeKind == Scope::Kind::MainProgram) {
+    // 8.5.16p4; BLOCK DATA entities must all be in COMMON,
----------------
jeanPerier wrote:
> This will trigger all main program objects to be static, whether they are scalars or not right ?
> 
> Currently, lowering was promoting main program array objects to static storage, but not scalars (which matches nvfortran/classic flang). Do we want/need a different behavior here ? 
8.5.16p4 says "A variable, common block, or procedure pointer declared in the scoping unit of a main program, module, or submodule implicitly has the SAVE attribute, which may be confirmed by explicit specification."  So yes.  This has a semantic consequence in that a pointer in the main program may be initialized with a local TARGET variable in the main program without that variable having an explicit SAVE attribute.


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

https://reviews.llvm.org/D114209



More information about the flang-commits mailing list