[flang-commits] [flang] [flang] Set SAVE attribute for EQUIVALENCEd symbols consistently. (PR #67078)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri Sep 22 16:44:29 PDT 2023


klausler wrote:

> It looks like the code formatting check is broken for some other PRs, so it should not be my problem.
> 
> More extensive testing uncovered the following problem.
> 
> ```
> module equiv
>   real dx,dy
>   common /blk/ dx
>   equivalence(dx,dy)
> end module
> ```
> 
> With my changes I get the following module file:
> 
> ```
> module equiv
> real(4),save::dx
> real(4),save::dy
> common/blk/dx
> equivalence(dx,dy)
> end
> ```
> 
> So the `SAVE` was explicitly printed, which causes `error: The entity 'dx' in COMMON block /blk/ may not have an explicit SAVE attribute` when the module is used.
> 
> I am planning to filter out the implicit `SAVE` in `mod-file.cpp`, but please let me know if I am on a wrong path.

The `SAVE` attribute should not have been emitted to the module file if it was only an implicit attribute, as it should have been in this case.  (If it is not an implicit attribute in the symbol table, that's the problem instead.).

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


More information about the flang-commits mailing list