[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / flang / test / Lower / constant-literal-mangling.f90
blob33a658fb61cd12c5f7d2aacdfb9cf53029d0f48f
1 ! Test the names created for globals holding constant literal values
2 ! RUN: bbc -emit-fir -o - %s | FileCheck %s
4 type someType
5 integer :: i
6 end type
8 type otherType
9 integer :: i
10 end type
12 type emptyType1
13 end type emptyType1
15 type emptyType2
16 end type emptyType2
18 print *, [42, 42]
19 ! CHECK: fir.address_of(@_QQro.2xi4.0)
21 print *, reshape([42, 42, 42, 42, 42, 42], [2,3])
22 ! CHECK: fir.address_of(@_QQro.2x3xi4.1)
24 print *, [42_8, 42_8]
25 ! CHECK: fir.address_of(@_QQro.2xi8.2)
27 print *, [0.42, 0.42]
28 ! CHECK: fir.address_of(@_QQro.2xr4.3)
30 print *, [0.42_8, 0.42_8]
31 ! CHECK: fir.address_of(@_QQro.2xr8.4)
33 print *, [.true.]
34 ! CHECK: fir.address_of(@_QQro.1xl4.5)
36 print *, [.true._8]
37 ! CHECK: fir.address_of(@_QQro.1xl8.6)
39 print *, [(1., -1.), (-1., 1)]
40 ! CHECK: fir.address_of(@_QQro.2xz4.7)
42 print *, [(1._8, -1._8), (-1._8, 1._8)]
43 ! CHECK: fir.address_of(@_QQro.2xz8.8)
45 print *, [someType(42), someType(43)]
46 ! CHECK: fir.address_of(@_QQro.2x_QFTsometype.9
48 ! Verify that literals of the same type/shape
49 ! are mapped to different global objects:
50 print *, [someType(11)]
51 ! CHECK: fir.address_of(@_QQro.1x_QFTsometype.10)
52 print *, [someType(42)]
53 ! CHECK: fir.address_of(@_QQro.1x_QFTsometype.11)
54 print *, [someType(11)]
55 ! CHECK: fir.address_of(@_QQro.1x_QFTsometype.10)
56 print *, [someType(42)]
57 ! CHECK: fir.address_of(@_QQro.1x_QFTsometype.11)
58 print *, [someType(11)]
59 ! CHECK: fir.address_of(@_QQro.1x_QFTsometype.10)
60 print *, [someType(42)]
61 ! CHECK: fir.address_of(@_QQro.1x_QFTsometype.11)
62 print *, [someType(11)]
63 ! CHECK: fir.address_of(@_QQro.1x_QFTsometype.10)
64 print *, [someType(42)]
65 ! CHECK: fir.address_of(@_QQro.1x_QFTsometype.11)
67 print *, [Character(4)::]
68 ! CHECK: fir.address_of(@_QQro.0x4xc1.null.12)
69 print *, [Character(2)::]
70 ! CHECK: fir.address_of(@_QQro.0x2xc1.null.13)
71 print *, [Character(2)::]
72 ! CHECK: fir.address_of(@_QQro.0x2xc1.null.13)
74 print *, [otherType(42)]
75 ! CHECK: fir.address_of(@_QQro.1x_QFTothertype.14)
77 print *, [emptyType1()]
78 print *, [emptyType2()]
79 end
81 ! CHECK: fir.global internal @_QQro.1x_QFTsometype.10 constant : !fir.array<1x!fir.type<_QFTsometype{i:i32}>> {
82 ! CHECK: %{{.*}} = arith.constant 11 : i32
83 ! CHECK: }
85 ! CHECK: fir.global internal @_QQro.1x_QFTsometype.11 constant : !fir.array<1x!fir.type<_QFTsometype{i:i32}>> {
86 ! CHECK: %{{.*}} = arith.constant 42 : i32
87 ! CHECK: }
89 ! CHECK: fir.global internal @_QQro.0x4xc1.null.12 constant : !fir.array<0x!fir.char<1,4>> {
90 ! CHECK: %[[T1:.*]] = fir.undefined !fir.array<0x!fir.char<1,4>>
91 ! CHECK: fir.has_value %[[T1]] : !fir.array<0x!fir.char<1,4>>
92 ! CHECK: }
94 ! CHECK: fir.global internal @_QQro.0x2xc1.null.13 constant : !fir.array<0x!fir.char<1,2>> {
95 ! CHECK: %[[T2:.*]] = fir.undefined !fir.array<0x!fir.char<1,2>>
96 ! CHECK: fir.has_value %[[T2]] : !fir.array<0x!fir.char<1,2>>
97 ! CHECK: }
99 ! CHECK: fir.global internal @_QQro.1x_QFTothertype.14 constant : !fir.array<1x!fir.type<_QFTothertype{i:i32}>> {
100 ! CHECK: %{{.*}} = arith.constant 42 : i32
101 ! CHECK: }