This patch implements @klausler's suggestion in llvm-project issue #58973; encountering the VOLATILE attribute should produce a warning, not a fatal error.
When tested on the following Fortran program snem0601_012_.f90:
fortran
module mod
contains
subroutine sub(m6,error)
integer,intent(inout) :: error
integer,volatile :: m6
if (any ((/m6/).ne.(/6/))) &
& then
error = 1
end if
end subroutine
end module
program fe1nvol12
use mod
integer :: error = 0
call sub(6,error)
if (error .ne. 0) then
print *,'NG: snem0601_012'
end if
print *,'pass: snem0601_012'
end program fe1nvol12the following output is produced:
bash
$ flang-new -fc1 snem0601_012_.f90
/noback/93u/Sandbox/issue_58973_volatile_dummy_arg/snem0601_012_.f90:21:12: warning: actual argument associated with VOLATILE dummy argument 'm6=' is not a variable
call sub(6,error)
^
An interesting thing about flang/test/Semantics/test_errors.py is that the python script won't check the stderr output _unless_ there's an error. For context, my contribution just checks for warnings, so stderr wasn't being inspected by test_errors.py. So, I just added a known error to check for from flang/test/Semantics/call02.f90. I thought this would be better than editing the test_errors.py script. If folks take issue with this, let me know.