Page MenuHomePhabricator

[flang] Fix erroneous application of SAVE statement
ClosedPublic

Authored by tskeith on Jul 15 2020, 12:32 PM.

Details

Summary

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.

Diff Detail

Event Timeline

tskeith created this revision.Jul 15 2020, 12:32 PM
Herald added a project: Restricted Project. · View Herald Transcript
sscalpone accepted this revision.Jul 15 2020, 12:42 PM
This revision is now accepted and ready to land.Jul 15 2020, 12:42 PM
klausler accepted this revision.Jul 15 2020, 12:48 PM

LGTM, thanks.

This revision was automatically updated to reflect the committed changes.