[PATCH] D83899: [flang] Fix erroneous application of SAVE statement

Tim Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 12:32:29 PDT 2020


tskeith created this revision.
tskeith added reviewers: klausler, PeteSteinfeld.
tskeith added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

A SAVE statement with no entity list applies the SAVE attribute only to
the entities that it is allowed on. We were applying it to automatic
data objects and reporting an error that they can't have SAVE.

The fix is to change `DeclarationVisitor::CheckSaveAttr` to check for
automatic objects. That controls both checking and setting the
attribute. This allows us to remove the check from `CheckSpecExpr`
(along with `symbolBeingChecked_`). Also, it was only called on constant
objects so the non-const overload can be eliminated.

The check in `CheckSpecExpr` is replaced by an explicit check for
automatic objects in modules. This caught an error in modfile03.f90 so
that part of the test was eliminated.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83899

Files:
  flang/lib/Semantics/check-declarations.cpp
  flang/lib/Semantics/resolve-names.cpp
  flang/test/Semantics/modfile03.f90
  flang/test/Semantics/resolve45.f90
  flang/test/Semantics/resolve77.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83899.278282.patch
Type: text/x-patch
Size: 4635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200715/1bfa02e4/attachment.bin>


More information about the llvm-commits mailing list