[all-commits] [llvm/llvm-project] b29756: [flang] Fix erroneous application of SAVE statement

Tim Keith via All-commits all-commits at lists.llvm.org
Wed Jul 15 13:03:04 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b297563a751ec390d895c6ac4430e37c5efbb340
      https://github.com/llvm/llvm-project/commit/b297563a751ec390d895c6ac4430e37c5efbb340
  Author: Tim Keith <tkeith at nvidia.com>
  Date:   2020-07-15 (Wed, 15 Jul 2020)

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

  Log Message:
  -----------
  [flang] Fix erroneous application of SAVE statement

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.

Differential Revision: https://reviews.llvm.org/D83899




More information about the All-commits mailing list