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

    <tr>
        <th>Summary</th>
        <td>
            [flang] llvm-flang error seen with Cray pointers and allocatable arrays
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:frontend,
            flang,
            flang:parser
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          dpalermo
      </td>
    </tr>
</table>

<pre>
    LLVM flang does not accept assumed-size in the array spec for Cray pointers.  The reproducer has two forms that produce identical errors:

```
program test_crayptr
  implicit none
  pointer(ivar,var)
  real*8 var(*) !works with gfortran, but not accepted by flang-new
 !pointer(ivar,var(*)) !alternative equivalent statement pair
  !real*8 var
  real*8, allocatable :: location(:)
  integer i

 allocate(location(10))
  ivar = loc(location)
  do i=1,10
    var(i) = i
  enddo
  write(*,*) location

end program test_crayptr
```

Info on Cray pointers https://docs.oracle.com/cd/E19957-01/805-4941/z40000a54ba7/index.html 

Error:

>> flang-new pointer_program.f90
error: Semantic errors in pointer_program.f90
./pointer_program.f90:4:10: error: Implied-shape array 'var' must be a named constant or a dummy argument
 real*8 var(*) !works with gfortran, but not accepted by flang-new
 ^^^

Program output from gfortran:
>> gfortran pointer_program.f90 -fcray-pointer
>> ./a.out
   1.0000000000000000 2.0000000000000000        3.0000000000000000        4.0000000000000000 5.0000000000000000        6.0000000000000000        7.0000000000000000 8.0000000000000000        9.0000000000000000        10.000000000000000
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU-P6yYQ_zTkMoqFIY7jQw7pZiM96VWq1KrXp7EZx7QYXMC73ffpKxw7m-xujo0sAvN_ht8MGII-W6I9K35hxXGFY-yc36sBDfnerWqn3vbfv__5K7QG7RmUowDWRcCmoSEChjD2pNZB_yTQFmJHgN7jG4SBGmidh6d0Gpy2kXzIAP7oCDwN3qmxIQ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