[flang-commits] [flang] [flang] Do not write implicit SAVE attribute into the mod file. (PR #67215)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Sat Sep 23 14:14:37 PDT 2023


================
@@ -244,6 +244,14 @@ bool ModFileWriter::PutComponents(const Symbol &typeSymbol) {
   }
 }
 
+// Return the symbol's attributes that should be written
+// into the mod file.
+static Attrs getSymbolAttrsToWrite(const Symbol &symbol) {
+  // Is SAVE attribute is implicit, it should be omitted
+  // to not violate F202x C862 for a common block member.
+  return symbol.attrs() & ~(symbol.implicitAttrs() & Attrs{Attr::SAVE});
----------------
vzakhari wrote:

I am not sure about this.  For example:
```
module equiv
  private
  real :: p
end module
```

`p` gets an implicit `PRIVATE` attribute resulting in this mod file:
```
module equiv
real(4),private::p
end
```

If I filter it out, I will get this:
```
module equiv
real(4)::p
end
```

https://github.com/llvm/llvm-project/pull/67215


More information about the flang-commits mailing list