Clang] Fix expansion of response files in -Wp after integrated-cc1 change
[llvm-project.git] / libcxxabi / test / unwind_06.pass.cpp
blob7d67f52f8e02dfd24651c2909c7e4e5c03f85fab
1 //===------------------------- unwind_06.cpp ------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: libcxxabi-no-exceptions
11 #include <exception>
12 #include <stdlib.h>
13 #include <assert.h>
14 #include <stdio.h>
16 // Compile with -Os to get compiler uses float registers to hold float variables
18 double get_(int x) { return (double)x; }
20 double (* volatile get)(int) = get_;
22 volatile int counter;
24 double try1(bool v) {
25 double a = get(0);
26 double b = get(1);
27 for (counter = 100; counter; counter = counter - 1)
28 a += get(1) + b;
29 if (v) throw 10;
30 return get(0)+a+b;
33 double try2(bool v) {
34 double a = get(0);
35 double b = get(1);
36 double c = get(2);
37 for (counter = 100; counter; counter = counter - 1)
38 a += get(1) + b + c;
39 if (v) throw 10;
40 return get(0)+a+b+c;
43 double try3(bool v) {
44 double a = get(0);
45 double b = get(1);
46 double c = get(2);
47 double d = get(3);
48 for (counter = 100; counter; counter = counter - 1)
49 a += get(1) + b + c + d;
50 if (v) throw 10;
51 return get(0)+a+b+c+d;
54 double try4(bool v) {
55 double a = get(0);
56 double b = get(0);
57 double c = get(0);
58 double d = get(0);
59 double e = get(0);
60 for (counter = 100; counter; counter = counter - 1)
61 a += get(1) + b+c+d+e;
62 if (v) throw 10;
63 return get(0)+a+b+c+d+e;
66 double try5(bool v) {
67 double a = get(0);
68 double b = get(0);
69 double c = get(0);
70 double d = get(0);
71 double e = get(0);
72 double f = get(0);
73 for (counter = 100; counter; counter = counter - 1)
74 a += get(1) + b+c+d+e+f;
75 if (v) throw 10;
76 return get(0)+a+b+c+d+e+f;
79 double try6(bool v) {
80 double a = get(0);
81 double b = get(0);
82 double c = get(0);
83 double d = get(0);
84 double e = get(0);
85 double f = get(0);
86 double g = get(0);
87 for (counter = 100; counter; counter = counter - 1)
88 a += get(1) + b+c+d+e+f+g;
89 if (v) throw 10;
90 return get(0)+a+b+c+d+e+f+g;
93 double try7(bool v) {
94 double a = get(0);
95 double b = get(0);
96 double c = get(0);
97 double d = get(0);
98 double e = get(0);
99 double f = get(0);
100 double g = get(0);
101 double h = get(0);
102 for (counter = 100; counter; counter = counter - 1)
103 a += get(1) + b+c+d+e+f+g+h;
104 if (v) throw 10;
105 return get(0)+a+b+c+d+e+f+g+h;
108 double try8(bool v) {
109 double a = get(0);
110 double b = get(0);
111 double c = get(0);
112 double d = get(0);
113 double e = get(0);
114 double f = get(0);
115 double g = get(0);
116 double h = get(0);
117 double i = get(0);
118 for (counter = 100; counter; counter = counter - 1)
119 a += get(1) + b+c+d+e+f+g+h+i;
120 if (v) throw 10;
121 return get(0)+a+b+c+d+e+f+g+h+i;
128 double foo()
130 double a = get(1);
131 double b = get(2);
132 double c = get(3);
133 double d = get(4);
134 double e = get(5);
135 double f = get(6);
136 double g = get(7);
137 double h = get(8);
138 try {
139 try1(true);
141 catch (int e) {
143 assert(a == get(1));
144 assert(b == get(2));
145 assert(c == get(3));
146 assert(d == get(4));
147 assert(e == get(5));
148 assert(f == get(6));
149 assert(g == get(7));
150 assert(h == get(8));
152 try {
153 try2(true);
155 catch (int e) {
157 assert(a == get(1));
158 assert(b == get(2));
159 assert(c == get(3));
160 assert(d == get(4));
161 assert(e == get(5));
162 assert(f == get(6));
163 assert(g == get(7));
164 assert(h == get(8));
166 try {
167 try3(true);
169 catch (int e) {
171 assert(a == get(1));
172 assert(b == get(2));
173 assert(c == get(3));
174 assert(d == get(4));
175 assert(e == get(5));
176 assert(f == get(6));
177 assert(g == get(7));
178 assert(h == get(8));
180 try {
181 try4(true);
183 catch (int e) {
185 assert(a == get(1));
186 assert(b == get(2));
187 assert(c == get(3));
188 assert(d == get(4));
189 assert(e == get(5));
190 assert(f == get(6));
191 assert(g == get(7));
192 assert(h == get(8));
194 try {
195 try5(true);
197 catch (int e) {
199 assert(a == get(1));
200 assert(b == get(2));
201 assert(c == get(3));
202 assert(d == get(4));
203 assert(e == get(5));
204 assert(f == get(6));
205 assert(g == get(7));
206 assert(h == get(8));
208 try {
209 try6(true);
211 catch (int e) {
213 assert(a == get(1));
214 assert(b == get(2));
215 assert(c == get(3));
216 assert(d == get(4));
217 assert(e == get(5));
218 assert(f == get(6));
219 assert(g == get(7));
220 assert(h == get(8));
222 try {
223 try7(true);
225 catch (int e) {
227 assert(a == get(1));
228 assert(b == get(2));
229 assert(c == get(3));
230 assert(d == get(4));
231 assert(e == get(5));
232 assert(f == get(6));
233 assert(g == get(7));
234 assert(h == get(8));
236 try {
237 try8(true);
239 catch (int e) {
241 assert(a == get(1));
242 assert(b == get(2));
243 assert(c == get(3));
244 assert(d == get(4));
245 assert(e == get(5));
246 assert(f == get(6));
247 assert(g == get(7));
248 assert(h == get(8));
250 return a+b+c+d+e+f+g+h;
255 int main()
257 foo();