1 // Test mapping between fir types and their runtime type descriptor objects.
2 // RUN: tco -o - %s | FileCheck %s
4 // Test mapping of derived type following the internal name ABI (i.e. that could come from an actual
5 // compiled Fortran program).
7 !sometype = !fir.type<_QFfooTsometype{num:i32,values:!fir.box<!fir.ptr<!fir.array<?x?xf32>>>}>
8 fir.global internal @_QFfooE.dt.sometype constant : i8
10 fir.global internal @_QFfooEx : !fir.box<!fir.heap<!sometype>> {
11 %0 = fir.zero_bits !fir.heap<!sometype>
12 %1 = fir.embox %0 : (!fir.heap<!sometype>) -> !fir.box<!fir.heap<!sometype>>
13 fir.has_value %1 : !fir.box<!fir.heap<!sometype>>
15 // CHECK: @_QFfooEx = internal global { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }
16 // CHECK-SAME: { ptr null, i64 ptrtoint (ptr getelementptr (%_QFfooTsometype, ptr null, i32 1) to i64),
17 // CHECK-SAME: i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooEXdtXsometype, [1 x i64] zeroinitializer }
19 !some_pdt_type = !fir.type<_QFfooTsome_pdt_typeK42K43{num:i32,values:!fir.box<!fir.ptr<!fir.array<?x?xf32>>>}>
20 fir.global internal @_QFfooE.dt.some_pdt_type.42.43 constant : i8
22 fir.global internal @_QFfooEx2 : !fir.box<!fir.heap<!some_pdt_type>> {
23 %0 = fir.zero_bits !fir.heap<!some_pdt_type>
24 %1 = fir.embox %0 : (!fir.heap<!some_pdt_type>) -> !fir.box<!fir.heap<!some_pdt_type>>
25 fir.has_value %1 : !fir.box<!fir.heap<!some_pdt_type>>
27 // CHECK: @_QFfooEx2 = internal global { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }
28 // CHECK-SAME: { ptr null, i64 ptrtoint (ptr getelementptr (%_QFfooTsome_pdt_typeK42K43, ptr null, i32 1) to i64),
29 // CHECK-SAME: i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooEXdtXsome_pdt_typeX42X43, [1 x i64] zeroinitializer }