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

    <tr>
        <th>Summary</th>
        <td>
            flang-new: assumed-rank variable not implemented
        </td>
    </tr>

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

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

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

<pre>
    The MPICH library (https://github.com/pmodels/mpich) `mpi_f08` Fortran binding is unable to be built with `flang-new` from recent `main` branch. This the error seen when testing compiler support for the necessary features.
```sh
ConvertVariable.cpp:1901: not yet implemented: assumed-rank variable in procedure implemented in Fortran
```
Is there any ETA on support for assumed-rank? I'm including the program we use to test compiler support for reproducibility.
```c
#include <ISO_Fortran_binding.h>

int foo_c(CFI_cdesc_t * a_desc, CFI_cdesc_t * b_desc)
{
        char * a_row = (char*) a_desc->base_addr;
        if (a_desc->type != CFI_type_int) { return 1; }
        if (a_desc->rank != 2) { return 2; }
        if (a_desc->dim[1].extent != b_desc->dim[0].extent) { return 3; }
        return 0;
}

void test_assumed_rank_async_impl_c(CFI_cdesc_t * a_desc)
{
        CFI_is_contiguous(a_desc);
        return;
}
```
```fortran
MODULE F08TS_MODULE
IMPLICIT NONE

! Test public, private, protected
REAL, PUBLIC       :: x
REAL, PRIVATE      :: y
LOGICAL, PROTECTED :: z

! Test abstract
ABSTRACT INTERFACE
    SUBROUTINE user_func(x, y)
        INTEGER  :: x(*)
        REAL     :: y
 END SUBROUTINE
END INTERFACE

! Test TS 29113 assumed type , assumed rank and bind(C)
INTERFACE
    FUNCTION FOO(A, B, C) &
 BIND(C,name="foo_c") RESULT(err)
        USE, intrinsic :: iso_c_binding, ONLY : c_int
        TYPE(*), DIMENSION(..) :: A, B, C
 INTEGER(c_int) :: err
    END FUNCTION FOO
END INTERFACE


! Test assumed-rank + asynchronous
INTERFACE TEST_ASSUMED_RANK_ASYNC
    SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL(BUF) &
        BIND(C,name="test_assumed_rank_async_impl_c")
 IMPLICIT NONE
        TYPE(*), DIMENSION(..), ASYNCHRONOUS :: BUF
 END SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL
END INTERFACE TEST_ASSUMED_RANK_ASYNC

CONTAINS

! Test TS 29113 asynchronous attribute and optional
SUBROUTINE test1(buf, count, ierr)
    INTEGER, ASYNCHRONOUS :: buf(*)
    INTEGER               :: count
    INTEGER, OPTIONAL     :: ierr
END SUBROUTINE

! Test procedure type and non-bind(c) x in C_FUNCLOC(x)
SUBROUTINE test2(func)
    USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_FUNLOC, C_FUNPTR
    PROCEDURE(user_func)  :: func
    TYPE(C_FUNPTR) :: errhandler_fn
    errhandler_fn = C_FUNLOC(func)
END SUBROUTINE

! Test intrinsic storage_size
SUBROUTINE test3(x, size)
    CHARACTER, DIMENSION(..) :: x
    INTEGER, INTENT(OUT) :: size
    size = storage_size(x)/8
END SUBROUTINE test3

END MODULE
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMV1tzqr4W_zTxJVMHQ6344AMi7s2cFjqK_5n9xAQMmnMwYZLQ1v-nP7MCXnCzL0zHkpV1v_xIqNb8IBhboOkSTVcj2pijVAtFy5IJZka53J8X6ZHht_co-I4rniuqzhgR72hMrZHrI7JGZH3g5tjk40KeEFnXJ7lnlUZkfap5cURkjtGLc6p5VjoeenHwWiqjqMA5F3suDphr3AiaVwwbiXOG84ZXBn9ycwTBsqLi8CTYJ4iWSp6wYgUTxiqlXAA5V1QUxzFOj1xjc2SYKSUV1owJ_HlkAhumDZgq5KnmFVNYN3UtlcGlVFZAsIJpDcGVjJpGMT1Gzgo5Pnpx2j99bAmBFB9MmX-o4uDzuKhr5PqTuTNBro-FNPjMDOanumInJgzbA5lq3ZzY_klR8T_80YliLnCtZMH2jWL3ErDR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