repo.or.cz
/
sdcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
struct / union in initializer, RFE #901.
[sdcc.git]
/
sdcc
/
support
/
regression
/
tests
/
bug-751703.c
blob
3f89a31623db1fdd715b53c35f0d9da242fc2b2d
1
/* bug-751703.c
2
3
Make sure extern within local scope binds to global
4
scope and is not optimized inappropriately.
5
*/
6
7
#include
"testfwk.h"
8
9
int
x
=
1
;
10
int
y
=
2
;
11
int
z
=
0
;
12
13
static void
14
addxy
(
void
)
15
{
16
extern
int
x
,
y
,
z
;
17
z
=
x
+
y
;
18
}
19
20
static void
21
times10x
(
void
)
22
{
23
unsigned char
x
;
24
25
z
=
0
;
26
for
(
x
=
0
;
x
<
10
;
x
++)
27
{
28
extern
int
x
;
/* bind to the global x */
29
z
+=
x
;
30
}
31
}
32
33
static void
34
testExternDeadCode
(
void
)
35
{
36
ASSERT
(
z
==
0
);
37
addxy
();
38
ASSERT
(
z
==
3
);
39
times10x
();
40
ASSERT
(
z
==
10
);
41
}