1 // Test that we can have a statement that throws in hot cold
2 // and a landing pad in cold code.
3 //
4 // Record performance data with no args. Run test with 2 args.
5 
6 #include <stdio.h>
7 #include <stdint.h>
8 
9 int foo()
10 {
11   return 0;
12 }
13 
14 void bar(int a) {
15   if (a > 2 && a % 2)
16     throw new int();
17 }
18 
19 void filter_only(){
20   foo();
21 }
22 
23 int main(int argc, char **argv)
24 {
25   unsigned r = 0;
26 
27   uint64_t limit = (argc >= 2 ? 10 : 500000000);
28   for (uint64_t i = 0; i < limit; ++i) {
29     i += foo();
30     try  {
31       bar(argc);
32       try {
33         if (argc >= 2)
34           throw new int();
35       } catch (...) {
36         printf("catch 2\n");
37         throw new int();
38       }
39     } catch (...) {
40       printf("catch 1\n");
41     }
42   }
43 
44   return 0;
45 }
46