Skip to content

[flang] Incorrect intrinsic assignment of derived type parent component #153032

@DanielCChen

Description

@DanielCChen

Consider the following reducer.

  type t
    integer :: a
  end type
  type, extends(t) :: t2
    integer :: b
  end type

  type(t), allocatable :: a(:)
  class(t), allocatable :: b(:)
  allocate(b(5), source=(/t2(1,1),t2(2,2),t2(3,3),t2(4,4),t2(5,5)/))
  a = b                                                                                                   !! a should get b%a
  print*, a%a
  if (any(a%a /= (/1,2,3,4,5/))) stop 2
end

Flang failed to assign b%a to a%a in intrinsic assignment a = b.

gfortran and XLF works fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions