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 fe1nvol12
the 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) ^
This is obviously going to work only for non-variables that also happen to be constant expressions. It will fail for non-variables that are runtime expressions. Try !IsVariable(actual).