1 // Test hlfir.assign code generation to FIR of derived type requiring
2 // or not finalization.
4 // RUN: fir-opt %s -convert-hlfir-to-fir | FileCheck %s
6 !t_simple = !fir.type<simple{i:i32}>
7 fir.type_info @simple noinit nodestroy nofinal : !t_simple
9 func.func @test_simple(%a: !fir.ref<!t_simple>, %b: !fir.ref<!t_simple>) {
10 hlfir.assign %b to %a : !fir.ref<!t_simple>, !fir.ref<!t_simple>
13 // CHECK-LABEL: func.func @test_simple(
15 // CHECK: %[[VAL_1:.*]] = fir.coordinate_of %{{.*}}, %{{.*}} : (!fir.ref<!fir.type<simple{i:i32}>>, !fir.field) -> !fir.ref<i32>
16 // CHECK: %[[VAL_3:.*]] = fir.coordinate_of %{{.*}}, %{{.*}} : (!fir.ref<!fir.type<simple{i:i32}>>, !fir.field) -> !fir.ref<i32>
17 // CHECK: %[[VAL_4:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32>
18 // CHECK: fir.store %[[VAL_4]] to %[[VAL_3]] : !fir.ref<i32>
21 !t_with_final = !fir.type<with_final{i:i32}>
22 fir.type_info @with_final noinit : !t_with_final
24 func.func @test_with_final(%a: !fir.ref<!t_with_final>, %b: !fir.ref<!t_with_final>) {
25 hlfir.assign %b to %a : !fir.ref<!t_with_final>, !fir.ref<!t_with_final>
28 // CHECK-LABEL: func.func @test_with_final(
29 // CHECK: fir.call @_FortranAAssign