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[] = "SEH0042.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 /* 22 * never gets here, break in finally 23 * when Index1 is 0 24 */ 25 Counter += 1; 26 } 27 } 28 finally { 29 /* set counter = 2 */ 30 Counter += 2; 31 #if defined(_MSC_VER) && !defined(__clang__) 32 break; 33 #endif 34 } 35 endtry 36 #ifndef _MSC_VER 37 break; 38 #endif 39 /* never gets here */ 40 Counter += 4; 41 } 42 finally { 43 /* adds 5 to counter while unwinding from "break" */ 44 Counter += 5; 45 } 46 endtry 47 Counter += 6; 48 } 49 50 if (Counter != 7) { 51 printf("TEST 42 FAILED. Counter = %d\n\r", Counter); 52 return -1; 53 } 54 55 return 0; 56 } 57