[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mono / tests / exception6.cs
1 using System;
2
3 public class Ex {
4
5         public static int test () {
6                 int ocount = 0;
7                 
8                 checked {
9
10                         ocount = 0;
11                         try {
12                                 ulong a =  UInt64.MaxValue - 1;
13                                 ulong t = a++;
14                         } catch {
15                                 ocount++;
16                         }
17                         if (ocount != 0)
18                                 return 1;
19
20                         ocount = 0;
21                         try {
22                                 ulong a =  UInt64.MaxValue;
23                                 ulong t = a++;
24                         } catch {
25                                 ocount++;
26                         }
27                         if (ocount != 1)
28                                 return 2;
29
30                         ocount = 0;
31                         try {
32                                 long a = Int64.MaxValue - 1;
33                                 long t = a++;
34                         } catch {
35                                 ocount++;
36                         }
37                         if (ocount != 0)
38                                 return 3;
39
40                         try {
41                                 long a = Int64.MaxValue;
42                                 long t = a++;
43                         } catch {
44                                 ocount++;
45                         }
46                         if (ocount != 1)
47                                 return 4;
48
49                         ocount = 0;
50                         try {
51                                 ulong a = UInt64.MaxValue - 1;
52                                 ulong t = a++;
53                         } catch {
54                                 ocount++;
55                         }
56                         if (ocount != 0)
57                                 return 5;
58
59                         try {
60                                 ulong a = UInt64.MaxValue;
61                                 ulong t = a++;
62                         } catch {
63                                 ocount++;
64                         }
65                         if (ocount != 1)
66                                 return 6;
67
68                         ocount = 0;
69                         try {
70                                 long a = Int64.MinValue + 1;
71                                 long t = a--;
72                         } catch {
73                                 ocount++;
74                         }
75                         if (ocount != 0)
76                                 return 7;
77
78                         ocount = 0;
79                         try {
80                                 long a = Int64.MinValue;
81                                 long t = a--;
82                         } catch {
83                                 ocount++;
84                         }
85                         if (ocount != 1)
86                                 return 8;
87
88                         ocount = 0;
89                         try {
90                                 ulong a = UInt64.MinValue + 1;
91                                 ulong t = a--;
92                         } catch {
93                                 ocount++;
94                         }
95                         if (ocount != 0)
96                                 return 9;
97
98                         ocount = 0;
99                         try {
100                                 ulong a = UInt64.MinValue;
101                                 ulong t = a--;
102                         } catch {
103                                 ocount++;
104                         }
105                         if (ocount != 1)
106                                 return 10;
107
108                         ocount = 0;
109                         try {
110                                 int a = Int32.MinValue + 1;
111                                 int t = a--;
112                         } catch {
113                                 ocount++;
114                         }
115                         if (ocount != 0)
116                                 return 11;
117
118                         ocount = 0;
119                         try {
120                                 int a = Int32.MinValue;
121                                 int t = a--;
122                         } catch {
123                                 ocount++;
124                         }
125                         if (ocount != 1)
126                                 return 12;
127
128                         ocount = 0;
129                         try {
130                                 uint a = 1;
131                                 uint t = a--;
132                         } catch {
133                                 ocount++;
134                         }
135                         if (ocount != 0)
136                                 return 13;
137
138                         ocount = 0;
139                         try {
140                                 uint a = 0;
141                                 uint t = a--;
142                         } catch {
143                                 ocount++;
144                         }
145                         if (ocount != 1)
146                                 return 14;
147
148                         ocount = 0;
149                         try {
150                                 sbyte a = 126;
151                                 sbyte t = a++;
152                         } catch {
153                                 ocount++;
154                         }
155                         if (ocount != 0)
156                                 return 15;
157
158                         ocount = 0;
159                         try {
160                                 sbyte a = 127;
161                                 sbyte t = a++;
162                         } catch {
163                                 ocount++;
164                         }
165                         if (ocount != 1)
166                                 return 16;
167
168                         ocount = 0;
169                         try {
170                         } catch {
171                                 ocount++;
172                         }
173                         if (ocount != 0)
174                                 return 17;
175
176                         ocount = 0;
177                         try {
178                                 int a = 1 << 29;
179                                 int t = a*2;
180                         } catch {
181                                 ocount++;
182                         }
183                         if (ocount != 0)
184                                 return 18;
185
186                         ocount = 0;
187                         try {
188                                 int a = 1 << 30;
189                                 int t = a*2;
190                         } catch {
191                                 ocount++;
192                         }
193                         if (ocount != 1)
194                                 return 19;
195
196                         ocount = 0;
197                         try {
198                                 ulong a = 0xffffffffff;
199                                 ulong t = a*0x0ffffff;
200                         } catch {
201                                 ocount++;
202                         }
203                         if (ocount != 0)
204                                 return 20;
205
206                         ocount = 0;
207                         try {
208                                 ulong a = 0xffffffffff;
209                                 ulong t = a*0x0fffffff;
210                         } catch {
211                                 ocount++;
212                         }
213                         if (ocount != 1)
214                                 return 21;
215                 }
216                 
217                 return 0;
218         }
219         public static int Main () {
220                 return test();
221         }
222 }
223
224