<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/125774>125774</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Incorrect diagnostic on intrinsic `ASSOCIATED` when the `TARGET` argument is unlimited polymorphic
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielCChen
</td>
</tr>
</table>
<pre>
Consider the following code
```
type :: bType
integer*4 :: i1
end type
type base
type (bType), pointer :: b1
end type
class (*), allocatable, target :: x
type (base) :: b1
if (.not. associated (b1%b1, x)) error stop(2_4)
end
```
Flang currently issues an error as:
```
./t.f:13:15: error: Arguments of ASSOCIATED() must be a pointer and an optional valid target
if (.not. associated (b1%b1, x)) error stop(2_4)
^^^^^^^^^^^^^^^^^^^^^
```
The code seems valid as the standard requires the type of `TARGET` to be compatible with `POINTER` argument.
Unlimited polymorphic entity is type compatible with all entities.
All ifort, gfortran and XLF compile the code successfully.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVFGPozYQ_jXmZXTIMZDAAw80u6lWqnrVXSr1rRrwAK6MTW2ze_n3lYHdZrftU8-yHMfMfDP-vvGg92owRDUrfmDFQ4JLGK2rH9Ao0ufzSCZprbzVZ2u8kuQgjAS91dq-KDNAZyUx3rAj3ydvAADCbSZgWcOyBtrrbab9PA5lAg3kmGjyVxN12L-TkatvhLxDatHfI2zootyQRcXEGWYbcd1b0P9A7DR6H32ZaHZP1Np2GLDVFP8GdAOFV5xvHzKJUWMyonoXaTdRfTRIjQ0poPe2UxhIrk4HJoq4nOHbGrcCcs468MHOTJTi9zwe84aM3PDuKWW8uWiMdC_OkQn6Bsr7hTyg2XHQx3zeu6VMXELas6w5ZHEpYr6redw0blgmMsGD7aH5-vXz-am5Pj6s3FQwLT5AS4BvzKKRMZydg7IGNTyjVnKn602c78AAfBisePxf8x9UXkda6xY80eT3e6BfK9sHNBKdBEd_LsrRdrpKb3tgR35tvvz4eGVHDsFGfjo7zRhUqwleVBijyS-fn36-Pn6JNrhznDLe_Gq0mlRkY7b6Nlk3j6oDMkGFKOcW5CMcar2ZKPLpln6jNajeuhCpHOLGoVnV-e2nywqgNK1pb5dcuo687xetb2ki60xWWYUJ1YdTVp54eSrLZKwlP3QlVr2syrZCKfviiBUXeXvixxPvD4mqBRcFFzwXIqvyMhVdlZd5ViKXGZ2yguWcJlQ61fp5Sq0bkrVE64MoTqc80diS9muXEaKPxcyypnfWhFjxQsTe4-ro-6ldBs9yrpUP_m-0oIJeu9T6EljxAE-ms85RF0AqHIz1QXVgTWwwThmvuijGXWEfObyMZFZq3in5qlJUYfk3lZLF6XoMYV4fmbgwcRlUGJc27ezExCUmuf98mp39g7rAxGV7okxcdgqea_FXAAAA__9daqGy">