[all-commits] [llvm/llvm-project] 9c8774: [flang] emit warning when encountering a non-varia...

Anthony Cabrera via All-commits all-commits at lists.llvm.org
Tue Dec 13 12:28:38 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c87746de7cdbb2b60a3fc274831aee43ddd9b7c
      https://github.com/llvm/llvm-project/commit/9c87746de7cdbb2b60a3fc274831aee43ddd9b7c
  Author: Cabrera, Anthony <cabreraam at ornl.gov>
  Date:   2022-12-13 (Tue, 13 Dec 2022)

  Changed paths:
    M flang/lib/Semantics/check-call.cpp
    A flang/test/Semantics/call30.f90

  Log Message:
  -----------
  [flang] emit warning when encountering a non-variable actual argument when its corresponding dummy argument expects a VOLATILE variable

This patch implements @klausler's suggestion in `llvm-project` [issue #58973](https://github.com/llvm/llvm-project/issues/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)
             ^
```

Reviewed By: clementval, klausler

Differential Revision: https://reviews.llvm.org/D139134




More information about the All-commits mailing list