struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-751703.c
blob3f89a31623db1fdd715b53c35f0d9da242fc2b2d
1 /* bug-751703.c
3 Make sure extern within local scope binds to global
4 scope and is not optimized inappropriately.
5 */
7 #include "testfwk.h"
9 int x = 1;
10 int y = 2;
11 int z = 0;
13 static void
14 addxy(void)
16 extern int x, y, z;
17 z = x+y;
20 static void
21 times10x(void)
23 unsigned char x;
25 z = 0;
26 for (x=0; x<10; x++)
28 extern int x; /* bind to the global x */
29 z += x;
33 static void
34 testExternDeadCode(void)
36 ASSERT(z == 0);
37 addxy();
38 ASSERT(z == 3);
39 times10x();
40 ASSERT(z == 10);