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-2195.c
blob
5e336cab70a6df2b71c7f3e93ee61eac796ad7bc
1
/*
2
bug1-2195.c
3
4
comparison in foo() destroyed value of child due to incorrect register survival tracking
5
*/
6
7
#include <testfwk.h>
8
9
int
g
(
void
)
10
{
11
static int
i
= -
2
;
12
return
(
i
++);
13
}
14
15
void
bar
(
int
i
)
16
{
17
ASSERT
(
i
== -
1
);
18
}
19
20
extern
void
baa
(
int
i
)
21
{
22
ASSERT
(
i
!= -
1
);
23
}
24
25
void
26
foo
(
void
)
27
{
28
int
child
;
29
30
child
=
g
();
31
32
if
(
child
== -
1
) {
33
bar
(
child
);
34
}
else
{
35
baa
(
child
);
36
}
37
}
38
39
void
testBug
(
void
)
40
{
41
foo
();
42
foo
();
43
foo
();
44
foo
();
45
foo
();
46
}
47