struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3240.c
blob5d4d2ac1045cdef14a669723b5d740f762efe318
1 /*
2 bug-3240.c. Stack register parameters were not correctly checked for having their address taken
3 resulting in incorrect tail call optimization, thus calls where spilt local variables in the calle
4 overwrote the spilt register parameter.
5 */
7 #include <testfwk.h>
9 #include <string.h>
11 void bar(void);
13 int *p;
15 void foo(int a) __z88dk_callee
17 p = &a;
18 bar();
21 void check(char *buffer)
23 ASSERT (*p == 23);
24 ASSERT (buffer[0] == 42);
27 void bar(void)
29 char buffer[8];
30 memset(buffer, 42, 8);
31 check(buffer);
34 void
35 testBug (void)
37 foo(23);
38 return;