[flang] Set declared type when NULLIFY a polymorphic pointer
authorValentin Clement <clementval@gmail.com>
Mon, 31 Oct 2022 10:02:50 +0000 (11:02 +0100)
committerValentin Clement <clementval@gmail.com>
Mon, 31 Oct 2022 10:03:13 +0000 (11:03 +0100)
commit90e9fcbb68a3afa3ac25aa54555355634554c349
tree25710c014a1e50180af2e49d334ae692d7267156
parenta2ab8fc46c63e6d21b6648202907a33064fbfb6e
[flang] Set declared type when NULLIFY a polymorphic pointer

Fortran standard 7.3.2.3 point 7 mentions that a diassociated
pointer dynamic type is its declared type.
in 9.7.2 note 1, when a NULLIFY statement is applied to a polymorphic pointer,
its dynamic type becomes the same as its declared type.
This patch enforce these standard points by calling the runtime function
`PointerNullifyDerived` with the declared type descriptor.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D136948
flang/include/flang/Optimizer/Builder/MutableBox.h
flang/include/flang/Optimizer/Builder/Runtime/Derived.h
flang/lib/Lower/Allocatable.cpp
flang/lib/Lower/Bridge.cpp
flang/lib/Optimizer/Builder/MutableBox.cpp
flang/lib/Optimizer/Builder/Runtime/Derived.cpp
flang/test/Lower/nullify-polymoprhic.f90 [new file with mode: 0644]