[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
Loading
Please sign in to comment