[flang-commits] [flang] [flang] Add lowering of volatile references (PR #132486)

Daniel Chen via flang-commits flang-commits at lists.llvm.org
Mon May 5 08:07:55 PDT 2025


DanielCChen wrote:

@ashermancinelli 
We still have a few regressions from this patch after I pulled the latest source just now (May 5).
The following is a reducer.

```
    type base
        integer :: p(10)
    end type

    type another
        class(*), pointer :: p(:)
    end type

    type(another), volatile :: a

    type(base), volatile, target :: b


    a%p => b%p

end
```

Flang complains
```
./t4.f:14:5: warning: VOLATILE target associated with non-VOLATILE pointer
      a%p => b%p
      ^^^^^^^^^^
./t4.f:6:30: Declaration of 'p'
          class(*), pointer :: p(:)
                               ^

```

The standard says in [8.5.20 VOLATILE attribute]
`If an object has the VOLATILE attribute, then all of its subobjects also have the VOLATILE attribute.`

So this code should be valid. The full test cases fails at verification of lowering.

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


More information about the flang-commits mailing list