blob: be23f175c8c8cebf66596d3df1c9d7a953f378a0 [file] [log] [blame]
Chris Lattner12f0c7b2007-02-07 23:28:08 +00001// RUN: %llvmgcc -S -fnested-functions -O0 -o - -emit-llvm %s
2// PR915
3
4extern void abort(void);
5
6void nest(int n)
7{
8 int a = 0;
9 int b = 5;
10 int c = 0;
11 int d = 7;
12
13 void o(int i, int j)
14 {
15 if (i!=j)
16 abort();
17 }
18
19 void f(x)
20 int x; /* K&R style */
21 {
22 int e = 0;
23 int f = 2;
24 int g = 0;
25
26 void y(void)
27 {
28 c = n;
29 e = 1;
30 g = x;
31 }
32
33 void z(void)
34 {
35 a = 4;
36 g = 3;
37 }
38
39 a = 5;
40 y();
41 c = x;
42 z();
43 o(1,e);
44 o(2,f);
45 o(3,g);
46 }
47
48 c = 2;
49 f(6);
50 o(4,a);
51 o(5,b);
52 o(6,c);
53 o(7,d);
54}