This is an archive of the discontinued LLVM Phabricator instance.

[flang] Carry over the derived type from MOLD
ClosedPublic

Authored by clementval on Feb 7 2023, 1:23 PM.

Details

Summary

Derived type from the MOLD was not carried over
to the newly allocated pointer or allocatable.
This may lead to wrong dynamic type when the pointer or allocatable
is polymorphic as shown in the example below:

type :: p1
  integer :: a
end type

type, extends(p1) :: p2
  integer :: b
end type

class(p1), pointer :: p(:)

allocate(p(5), MOLD=p2(1,2))

Diff Detail

Event Timeline

clementval created this revision.Feb 7 2023, 1:23 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 7 2023, 1:23 PM
Herald added a subscriber: sunshaoce. · View Herald Transcript
clementval requested review of this revision.Feb 7 2023, 1:23 PM
klausler accepted this revision.Feb 7 2023, 1:24 PM
This revision is now accepted and ready to land.Feb 7 2023, 1:24 PM
This revision was automatically updated to reflect the committed changes.