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 <setjmp.h>
7 #include "seh.h"
8 
9 char test[] = "SEH0020.c";
10 int perfect;
11 
12 int main() {
13   jmp_buf JumpBuffer;
14   LONG Counter;
15 
16   Counter = 0;
17 
18   if (_setjmp(JumpBuffer) == 0) {
19     /* set counter = 1 */
20     //(volatile LONG) Counter += 1;
21     *(volatile LONG*)&Counter += 1;
22     longjmp(JumpBuffer, 1);
23   } else {
24     /* set counter = 2 */
25     //(volatile LONG) Counter += 1;
26     *(volatile LONG*)&Counter += 1;
27   }
28 
29   if (Counter != 2) {
30     printf("TEST 20 FAILED. Counter = %d\n\r", Counter);
31     return -1;
32   }
33 
34   return 0;
35 }
36