flang icon indicating copy to clipboard operation
flang copied to clipboard

Flang does not flag an error when volatile is used in a Pure Subroutine

Open CarolineConcatto opened this issue 4 years ago • 0 comments

A pure procedure must not specify that any entity is VOLATILE. In addition, it must not contain any references to data that is VOLATILE. This minimal test runs all right with Flang, but it should raise an error for failVol:

Module test
  Integer,Volatile :: failVol
Contains
  Pure Subroutine sub_pure(a)
    Integer,Intent(Out) :: a
      a = a + failVol
  End Subroutine
end module

Program fail
  Use test
End Program

CarolineConcatto avatar Mar 26 '20 17:03 CarolineConcatto