ReactOS 0.4.15-dev-7924-g5949c20
vcatch.cpp
Go to the documentation of this file.
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// Write to volatiles in the catch to try and verify that we have
6// a correct catch frame prolog and epilog.
7
8#include <stdio.h>
9#include <malloc.h>
10
12{
13 X() : x(3) { }
14 ~X() { }
15 volatile int x;
16};
17
18void t(char * c)
19{
20 c[4] = 'a';
21 throw 123;
22}
23
24bool f()
25{
26 char * buf = (char *) _alloca(10);
27 X x;
28 volatile bool caught = false;
29
30 try
31 {
32 t(buf);
33 }
34 catch(int)
35 {
36 caught = true;
37 x.x = 2;
38 }
39
40 return caught;
41}
42
43int main()
44{
45 bool result = false;
46
47 __try {
48 result = f();
49 }
50 __except(1)
51 {
52 printf("ERROR - Unexpectedly caught an exception\n");
53 }
54
55 printf(result ? "passed\n" : "failed\n");
56 return result ? 0 : -1;
57}
int align(int length, int align)
Definition: dsound8.c:36
#define printf
Definition: freeldr.h:93
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble GLdouble t
Definition: gl.h:2047
const GLubyte * c
Definition: glext.h:8905
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint64EXT * result
Definition: glext.h:11304
#define X(b, s)
bool f()
Definition: vcatch.cpp:24
__declspec(align(64)) struct X
Definition: vcatch.cpp:11
int main()
Definition: vcatch.cpp:43