Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-2195.c
blob5e336cab70a6df2b71c7f3e93ee61eac796ad7bc
1 /*
2 bug1-2195.c
4 comparison in foo() destroyed value of child due to incorrect register survival tracking
5 */
7 #include <testfwk.h>
9 int g(void)
11 static int i = -2;
12 return(i++);
15 void bar(int i)
17 ASSERT(i == -1);
20 extern void baa(int i)
22 ASSERT(i != -1);
25 void
26 foo(void)
28 int child;
30 child = g();
32 if (child == -1) {
33 bar(child);
34 } else {
35 baa(child);
39 void testBug(void)
41 foo();
42 foo();
43 foo();
44 foo();
45 foo();