struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3238.c
blobc68dac257c0a5bdb0191215413808ded09ed6eb8
1 /*
2 bug-3238.c. Spilt 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 int *c;
13 void bar(void);
15 void foo(int a) __z88dk_fastcall
17 c = &a;
18 bar();
21 void check(char *buffer)
23 ASSERT (*c == 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;