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

    <tr>
        <th>Summary</th>
        <td>
            [fang] Compilation error in automatic statement
        </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>
    [As discussed at Discourse](https://discourse.llvm.org/t/request-advice-on-reporting-many-errors-found-in-fortran-test-sets/65868), we Fujitsu have started to report bugs.  

```
Version of flang-new : 16.0.0(e0fb01e97b6b7d2fe66b17b36eeb98aa78c6e3bb)
```

It seems that `automatic` statement cannot be used in a program.  
GNU's Fortran compiler is OK.  

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

memcpy006_.f90:
```fortran
program main
 call sub(10)
end program main

subroutine sub(n)
real(kind=8) :: a(n)
automatic :: a
 do i=1,n
  a(i) = i
 enddo
 write(6,*) "a(10)=",a(10)
end
```

```
$ flang-new -flang-experimental-exec memcpy006_.f90
error: Could not parse memcpy006_.f90
./memcpy006_.f90:7:11: error: expected '('
  automatic :: a
            ^
./memcpy006_.f90:7:1: in the context: statement function definition
  automatic :: a
  ^
./memcpy006_.f90:7:1: in the context: declaration construct
  automatic :: a
  ^
./memcpy006_.f90:6:1: in the context: specification part
  real(kind=8) :: a(n)
  ^
./memcpy006_.f90:5:1: in the context: SUBROUTINE subprogram
  subroutine sub(n)
  ^
$
```

```
$ gfortran memcpy006_.f90 -fdec-static
$ ./a.out
 a(10)=   10.000000000000000
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVdtyozgQ_Rr8ooJCwgj8wEMmnmxNbdVM1e5kXrcEamxlheSVRDL5-20BJnEyk-zFBVhqSd2nT1_UWvnYJOWHK0-k8t3oPUgiAtnjxI7OQ1LuE1YfQzj5pLhK2A0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