Issue 125774
Summary [Flang] Incorrect diagnostic on intrinsic `ASSOCIATED` when the `TARGET` argument is unlimited polymorphic
Labels flang:frontend
Assignees
Reporter DanielCChen
    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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to