! Test lowering of derived type assignments ! RUN: bbc -emit-hlfir -I nw %s -o - | FileCheck %s ! Assignment of simple "struct" with trivial intrinsic members. subroutine test1 type t integer a integer b end type t type(t) :: t1, t2 t1 = t2 end subroutine test1 ! CHECK-LABEL: func.func @_QPtest1() { ! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.type<_QFtest1Tt ! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFtest1Et1"} : (!fir.ref : (!fir.ref, uniq_name = "_QMm2Ft_to_tEa1"} : (!fir.ref, uniq_name = "_QMm2Ft_to_tEb1"} : (!fir.ref ! CHECK: %[[VAL_7:.*]] = hlfir.designate %[[VAL_3]]#0{"a"} : (!fir.ref ! CHECK: %[[VAL_8:.*]] = hlfir.designate %[[VAL_4]]#0{"a"} : (!fir.ref ! CHECK: %[[VAL_10:.*]] = hlfir.designate %[[VAL_3]]#0{"b"} : (!fir.ref ! CHECK: return ! CHECK: } end module m2 subroutine test3 type t character(LEN=20) :: m_c integer :: m_i end type t type(t) :: t1, t2 t1 = t2 end subroutine test3 ! CHECK-LABEL: func.func @_QPtest3() { ! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.type<_QFtest3Tt ! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFtest3Et1"} : (!fir.ref, uniq_name = "_QFtest_box_assignEt1"} : (!fir.ref, uniq_name = "_QFtest_box_assignEt2"} : (!fir.ref user_def end type interface subroutine user_def(other, self) import t0 class(t0), intent(out) :: other class(t0), intent(in) :: self end subroutine end interface ! Assignments of type(t) must call the user defined assignment for component a. ! Currently this is delegated to the runtime. type t type(t0) :: a integer :: i end type contains subroutine test(t1, t2) type(t) :: t1, t2 t1 = t2 end subroutine ! CHECK-LABEL: func.func @_QMcomponent_with_user_def_assignPtest( ! CHECK: %[[VAL_2:.*]] = fir.dummy_scope : !fir.dscope ! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %{{.*}} dummy_scope %[[VAL_2]] arg {{[0-9]+}} {uniq_name = "_QMcomponent_with_user_def_assignFtestEt1"} : (!fir.ref