1
2// TEST-OPTIONS: -arch i386
3// TEST-OPTIONS: -arch i386 -Wl,-no_compact_unwind
4// TEST-OPTIONS: -arch x86_64
5// TEST-OPTIONS: -arch x86_64  -Wl,-no_compact_unwind
6// TEST-OPTIONS: -arch ppc
7
8#include <stdio.h>
9
10int global = 0;
11
12int bar()
13{
14	global = 1;
15	throw 10;
16
17}
18
19
20void foo()
21{
22	try {
23		bar();
24	}
25	catch(int x) {
26		global = 2;
27		throw x;
28	}
29}
30
31
32
33int main()
34{
35	int state = 1;
36	try {
37		state = 2;
38		foo();
39		state = 3;
40	}
41	catch (int x) {
42		if ( state != 2 )
43			return 1;
44		if ( x != 10 )
45			return 1;
46		state = 4;
47	}
48
49	if ( (state == 4) && (global == 2) )
50		return 0;
51	else
52		return 1;
53}
54
55