brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · 5bd0149 Raw
198 lines · plain
1! RUN: bbc -emit-hlfir %s -o - -I nowhere | FileCheck %s2 3module types4  type t15     real :: x6  end type t17  type t28     real, allocatable :: x9  end type t210  type t311     real, pointer :: p12  end type t313  type t414     type(t1) :: c15  end type t416  type t517     type(t2) :: c18  end type t519  type t620   contains21     final :: finalize_t622  end type t623  type, extends(t1) :: t724  end type t725  type, extends(t2) :: t826  end type t827  type, extends(t6) :: t928  end type t929contains30  subroutine finalize_t6(x)31    type(t6), intent(inout) :: x32  end subroutine finalize_t633end module types34 35subroutine test136  use types37  interface38     function ret_type_t139       use types40       type(t1) :: ret_type_t141     end function ret_type_t142  end interface43  type(t1) :: x44  x = ret_type_t1()45end subroutine test146! CHECK-LABEL:   func.func @_QPtest1() {47! CHECK-NOT: fir.call{{.*}}Destroy48 49subroutine test1a50  use types51  interface52     function ret_type_t1a53       use types54       type(t1), allocatable :: ret_type_t1a55     end function ret_type_t1a56  end interface57  type(t1), allocatable :: x58  x = ret_type_t1a()59end subroutine test1a60! CHECK-LABEL:   func.func @_QPtest1a() {61! CHECK-NOT: fir.call{{.*}}Destroy62! CHECK:           fir.if %{{.*}} {63! CHECK-NEXT:        fir.freemem %{{.*}} : !fir.heap<!fir.type<_QMtypesTt1{x:f32}>>64! CHECK-NOT: fir.call{{.*}}Destroy65! CHECK:           fir.if %{{.*}} {66! CHECK:             fir.call @_FortranAAllocatableDeallocate({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, i1, !fir.box<none>, !fir.ref<i8>, i32) -> i3267! CHECK-NOT: fir.call{{.*}}Destroy68 69subroutine test1c70  use types71  interface72     function ret_class_t173       use types74       class(t1), allocatable :: ret_class_t175     end function ret_class_t176  end interface77  type(t1) :: x78  x = ret_class_t1()79end subroutine test1c80! CHECK-LABEL:   func.func @_QPtest1c() {81! CHECK: fir.call @_FortranADestroy82! CHECK:           fir.if %{{.*}} {83! CHECK-NEXT:        fir.freemem %{{.*}} : !fir.heap<!fir.type<_QMtypesTt1{x:f32}>>84 85subroutine test286  use types87  interface88     function ret_type_t289       use types90       type(t2) :: ret_type_t291     end function ret_type_t292  end interface93  type(t2) :: x94  x = ret_type_t2()95end subroutine test296! CHECK-LABEL:   func.func @_QPtest2() {97! CHECK: fir.call @_FortranADestroy98 99subroutine test3100  use types101  interface102     function ret_type_t3103       use types104       type(t3) :: ret_type_t3105     end function ret_type_t3106  end interface107  type(t3) :: x108  x = ret_type_t3()109end subroutine test3110! CHECK-LABEL:   func.func @_QPtest3() {111! CHECK-NOT: fir.call{{.*}}Destroy112 113subroutine test4114  use types115  interface116     function ret_type_t4117       use types118       type(t4) :: ret_type_t4119     end function ret_type_t4120  end interface121  type(t4) :: x122  x = ret_type_t4()123end subroutine test4124! CHECK-LABEL:   func.func @_QPtest4() {125! CHECK-NOT: fir.call{{.*}}Destroy126 127subroutine test5128  use types129  interface130     function ret_type_t5131       use types132       type(t5) :: ret_type_t5133     end function ret_type_t5134  end interface135  type(t5) :: x136  x = ret_type_t5()137end subroutine test5138! CHECK-LABEL:   func.func @_QPtest5() {139! CHECK: fir.call @_FortranADestroy140 141subroutine test6142  use types143  interface144     function ret_type_t6145       use types146       type(t6) :: ret_type_t6147     end function ret_type_t6148  end interface149  type(t6) :: x150  x = ret_type_t6()151end subroutine test6152! CHECK-LABEL:   func.func @_QPtest6() {153! CHECK: fir.call @_FortranADestroy154! CHECK: fir.call @_FortranADestroy155 156subroutine test7157  use types158  interface159     function ret_type_t7160       use types161       type(t7) :: ret_type_t7162     end function ret_type_t7163  end interface164  type(t7) :: x165  x = ret_type_t7()166end subroutine test7167! CHECK-LABEL:   func.func @_QPtest7() {168! CHECK-NOT: fir.call{{.*}}Destroy169 170subroutine test8171  use types172  interface173     function ret_type_t8174       use types175       type(t8) :: ret_type_t8176     end function ret_type_t8177  end interface178  type(t8) :: x179  x = ret_type_t8()180end subroutine test8181! CHECK-LABEL:   func.func @_QPtest8() {182! CHECK: fir.call @_FortranADestroy183 184subroutine test9185  use types186  interface187     function ret_type_t9188       use types189       type(t9) :: ret_type_t9190     end function ret_type_t9191  end interface192  type(t9) :: x193  x = ret_type_t9()194end subroutine test9195! CHECK-LABEL:   func.func @_QPtest9() {196! CHECK: fir.call @_FortranADestroy197! CHECK: fir.call @_FortranADestroy198