1 // Copyright (c) Microsoft. All rights reserved.
2 // Licensed under the MIT license. See LICENSE file in the project root for
3 // full license information.
4 
5 #include <windows.h>
6 #include "seh.h"
7 
8 char test[] = "SEH0039.c";
9 int perfect;
10 
11 int main() {
12   ULONG Index1;
13   LONG Counter;
14 
15   Counter = 0;
16 
17   for (Index1 = 0; Index1 < 10; Index1 += 1) {
18     try {
19       try {
20         if ((Index1 & 0x1) == 1) {
21           /* end the for loop when index is 1 */
22           break;
23         } else {
24           /* only add 1 if Index1 is 0 */
25           Counter += 1;
26         }
27       }
28       except(1) { Counter += 10; } endtry
29       /* only add 2 if index1 is 0 */
30       Counter += 2;
31     }
32     except(1) { Counter += 20; } endtry
33     /* only add 3 if index1 is 0 */
34     Counter += 3;
35   }
36 
37   if (Counter != 6) {
38     printf("TEST 39 FAILED. Counter = %d\n\r", Counter);
39     return -1;
40   }
41 
42   return 0;
43 }
44