<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94386>94386</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compile time crash in nested `ASSOCIATE` construct.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
bug,
flang:fir-hlfir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielCChen
</td>
</tr>
</table>
<pre>
Consider the following code:
```
character(3) :: char(3)
associate (x=>fun(char))
associate (item => x(1:2))
end associate
end associate
contains
function fun(char)
character(3) :: char(3)
character(:), allocatable :: fun(:)
end function
end
```
Flang currently crashes at
```
llvm-project/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp:588: virtual mlir::LogicalResult (anonymous namespace)::DesignateOpConversion::matchAndRewrite(hlfir::DesignateOp, mlir::PatternRewriter &) const: Assertion `sliceFields.empty() && substring.empty()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyclN9uqzgQxp_GuRkd5JrwJxdcsEnRVqrUo7YvYMwA3jU2soec0336lSHZpke5WJ0oIsp4Ps988zOWIejBIlYs-4Nlp51caHS-Okmr0RyPI9pd67qP6uhs0B16oBGhd8a4H9oOoFyHLK0ZPzFes5xfvutfAAA1Si8VoWeiTJk4QExO6zV-CV20N0-QITilJSEwUf5k6Ymlj_1imSg33eE_GVw-XxSacIJNBT-ZKB9YWot7KrTdp_Jz6U74xpGzJLUNv8b7xSrSzsLXRm_r_e9h3MmPqdHBEaQxTkmSrcHrBlvJS8oXG9eutija7i6p7dkYGYku3qMl8wHKyzBiAElwV2XMefo2e_cXKmKi6aOcicbolonmZSY96X9i782fz83TKxPNu5c29M5PgYnm6OwZPb275uk1UfPM0jorowc4a0-LNDAZ7TeDz27QSppXDIuhSFhaZz8mtwSwcsIwS4XR-pp8wniiJeHLvNUI0f-6NElSY227V_zhNSET5Wj6a5EbXRzzZ_Xvkgi9vYg8MJFHeMrZQLHfOgT0K3qW82C0wkaj6UKC00wfEUxEHUU5hKUN5LUdbheZKKCX2mCXbJP9_vxYvz3G5EkTSGiXATzOzhOQg5FoDivsholm0DQubaLcFGdvztefGzI6hAXjzEHaDrRVZulwfZFXxNBK9Td5qTD5hfOuq9LukB7kDquH4qHIRFYc0t1Y9W3WthLFvig6xblSQrYq531a9Gqf82KnK8HFnud8_1CKQ8aTnhdpx7Mey3zfyTZle46T1CaJvSbOD7u1y-qwT8t8Z2SLJqx3khDtMjAhmDgyIbZDlta99t82dkLEa8tXq-d2GQLbc6MDhc-dSZNZL7j1hLPsBEc3zdogkJ6uQ9AWLAbCLlKs395ejk_1-yPL-QbaL4qS3eJN9fvj37ydK_FvAAAA___6lqWR">