<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58972>58972</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [flang] Compilation error in move_alloc
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ohno-fj
      </td>
    </tr>
</table>

<pre>
    ```
Version of flang-new : 16.0.0(e0fb01e97b6b7d2fe66b17b36eeb98aa78c6e3bb)
```

`move_alloc` results in a compilation error.  
GNU's Fortran compiler is OK.  

The following are the test program, flang-new compilation results, and gfortran compilation results.  

snggp206_.f90:
```fortran
module mod
  integer,allocatable,protected :: from(:)
  integer,allocatable,protected :: to(:)
  contains
  subroutine sub()
    allocate(from(10))
    from = 100
  end subroutine
end module

use mod
call sub()
call move_alloc(from,to)
if (any(to/=100))write(6,*) "NG"
print *,'snggp206 : pass'
end
```

```
$ flang-new -flang-experimental-exec snggp206_.f90
error: Semantic errors in snggp206_.f90
./snggp206_.f90:13:17: error: Actual argument associated with INTENT(IN OUT) dummy argument 'from=' must be definable
  call move_alloc(from,to)
                  ^^^^
./snggp206_.f90:13:17: 'from' is protected in this scope
  call move_alloc(from,to)
                  ^^^^
./snggp206_.f90:13:22: error: Actual argument associated with INTENT(OUT) dummy argument 'to=' must be definable
  call move_alloc(from,to)
                       ^^
./snggp206_.f90:13:22: 'to' is protected in this scope
  call move_alloc(from,to)
                       ^^
$
```

```
$ gfortran snggp206_.f90
$ ./a.out
 snggp206 : pass
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9VUtv2zAM_jX2hagh2_EjBx-6ZhmGAdlh3a6FZNOOBtkKJHld__0o23k03YZuwBYYsklR5MdPJCN081QFOVsetgnY7Rc0VuoBdAut4kN3M-AjBOktxHnEIhYkJbJWsBjXhchF0SQt5rmIC5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