[all-commits] [llvm/llvm-project] 01e8e5: [flang] Restore declared type when deallocating po...

Valentin Clement (バレンタイン クレメン) via All-commits all-commits at lists.llvm.org
Thu Jan 12 02:12:46 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 01e8e50ce397dcb08e7dfadab93a53ae31174c67
      https://github.com/llvm/llvm-project/commit/01e8e50ce397dcb08e7dfadab93a53ae31174c67
  Author: Valentin Clement <clementval at gmail.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M flang/include/flang/Lower/Allocatable.h
    M flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
    M flang/include/flang/Runtime/allocatable.h
    M flang/include/flang/Runtime/pointer.h
    M flang/lib/Lower/Allocatable.cpp
    M flang/lib/Lower/ConvertVariable.cpp
    M flang/runtime/allocatable.cpp
    M flang/runtime/pointer.cpp
    M flang/test/Lower/allocatable-polymorphic.f90
    M flang/test/Lower/intentout-deallocate.f90
    M flang/test/Lower/polymorphic-types.f90

  Log Message:
  -----------
  [flang] Restore declared type when deallocating polymorphic entities

As mentioned in section 7.3.2.3 note 7, The dynamic type of an unallocated
allocatable object or a disassociated pointer is the same as its declared type.

This patch adds two function to the runtime:
- `PointerDeallocatePolymorphic`
- `AllocatableDeallocatePolymorphic`

These two functions take a DerivedTypeDesc pointer of the declared type.
The lowering is updated accordingly to call these functions for polymorphic
and unlimited polyrmophic entities. For unlimited polymorphic entities, the
dynamic type is set to nullptr when the entity is on an unallocated or
disassociated state.

Reviewed By: PeteSteinfeld, klausler

Differential Revision: https://reviews.llvm.org/D141519




More information about the All-commits mailing list