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

    <tr>
        <th>Summary</th>
        <td>
            [flang] Fortran/gfortran/regression/entry_23.f crashes on AArch64 and LoongArch, but passes on x86
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

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

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

<pre>
    The [entry_23.f](https://github.com/llvm/llvm-test-suite/blob/main/Fortran/gfortran/regression/entry_23.f) test in the gfortran test suite fails because it raises a segmentation fault at runtime on AArch64 and LoongArch, but works correctly on x86. It is possible that this test fails on other non-x86 platforms as well, but these are the only two [of which I am aware](https://github.com/llvm/llvm-test-suite/pull/187#issuecomment-2530003867). 

Steps to reproduce. Compile `entry_23.f` and run the resulting executable. For example, from the root of a checkout of the llvm-test-suite, this would be: 

```
$ flang -o ./entry_23 ./Fortran/gfortran/regression/entry_23.f
$ ./entry_23
```

Unexpected failure on AArch64

```
$ ./entry_23
 CHAR_SUB
 len(carray(1)) 20
zsh: segmentation fault  ./entry_23
```

Expected success on x86

```
 CHAR_SUB
 len(carray(1)) 20
 Something           Something Something           Something         
   
 CHAR_SUB
 len(carray(1)) 20
 Something           Something           Something           Something 
   
Fortran STOP
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVE2P2zYQ_TX0ZbACRdmWdNDBu1uhAQq06CbngKJGEhuKFMhhvO6vLyits0YSNJuihGFx-PHmzczjyBD0aBEbdrhnh8edjDQ535D00S5edlPcda6_NO8nBHa4R0v-8lEU2cAOj0xUE9ESWHFiomWiHTVNscuUm5lojfl8_dwRBroLURMy0XbGdUy0s9SWibZ1nrxMs3H4MvU4egxBu2Tc-BQ1JCjQFmhCuN7YFld8GKQ2ATpUMgYETeClDhhAQsBxRkuStLMwyGgIJIGPlvSM4CycTl5Nxz1I28Nvztkx2Uw8QBcJzs5_CqCc96jIXNL55-qYwTsCHWBxIejOINAkCWjSYeO0sXEWHE3owTp791wdYTGSBufnADLAGY25eqEJA4L0uMbnrLkAnV3KvBvgPGk1wTuQM8iz9PjfS7DE5LLNq5KJQocQUbk5JedOHArOeVEdSybqDBg_MX56IlwCkAOPi3d9VJjBg5sXbRDYkd8U6MjX7Pm4FchjiIa0HQGfUUWSncEMWucBn-W8GExxD97N22nnCNwAEtSE6pOLq5V2vongYcvx2UXTQ4esOL1QZUf-8uMnJvYwGGlHuHOQ3ShpNX5KeBvYLcbXvvjpg8XnBRVhv5Y9-ltRfZ_dV4Dw8Ovpz49PH-7T3KBlolLSe3lhosqZqJP-Rbr7d5hSyN9R9A84_nJlGKJSGMKLjL9l92Yq8ORmpCnV-HW8rv377nUknO3_f3L71rUvjl_UAE_vf__jNhW7vin6uqjlDpu8LIrqkFd8v5uaotz3HS9EfexLVRZ5Uaqqlrw8qppXqqx3uhFc7HOR87wsOBcZr4pD3ouaD1UlVS3ZnuMstcmSujPnx936Eps8r_d5tTOyQxPWvizEKmMmRGrRvlmfQxfHwPbc6EDhFYI0mbWZbzcOj_AzOgflZZgw_LAbLjIEvKpnF71p3tiGFu_-QkVMtGuwIXWhLd7PjfgnAAD__x0PDbo">