[flang] Fix associating entity when selector is an array, pointer or allocatable
authorValentin Clement <clementval@gmail.com>
Thu, 15 Dec 2022 11:02:11 +0000 (12:02 +0100)
committerValentin Clement <clementval@gmail.com>
Thu, 15 Dec 2022 11:02:38 +0000 (12:02 +0100)
commit9379ca0a257780961a7e77c1a56c70d00cd85909
treeeaa4b472fd7232088ddca3962155545c1838b114
parent0cd9c5176639a62f825cba5a2b2ed4bfbd8b3372
[flang] Fix associating entity when selector is an array, pointer or allocatable

In SELECT TYPE, within the block following TYPE IS, the associating entity is not polymorphic.
It has the type named in the type guard and other properties taken from the
selector. Within the block following a CLASS IS type guard statement, the
associating entity is polymorphic and has the declared type named in the type
guard statement.
This patch makes sure the associating entity matches the selector if it is
an array, a pointer or an allocatable.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D140017
flang/include/flang/Optimizer/Dialect/FIROps.td
flang/lib/Lower/Bridge.cpp
flang/lib/Optimizer/Dialect/FIROps.cpp
flang/test/Lower/select-type.f90