struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3675.c
blob8cc14c482a18d88333d0b049cd51ded842ebeac0
1 /* bug-3642.c
2 A bug in handling of parameters to nested function calls (outer one explicit, inner one via helper function)
3 that resulted in a register parameter being sent to the wrong function.
4 */
6 #include <testfwk.h>
8 struct s
10 unsigned int i;
13 // Need a function where the first paremeter is an integer parameter small enough to be passed in registers, followed by a struct parameter.
14 void f(unsigned int i, struct s s)
16 ASSERT (i == 0x5a5a);
17 ASSERT (s.i == 0xa5a5);
20 void
21 testBug (void)
23 #ifndef __SDCC_ds390 // Fails to link
24 struct s s = {0xa5a5};
26 f(0x5a5a, s); // When passing s, a memcpy call will be used as helper function. The 0x5a5a will be passed as if it was an additional parameter to that memcpy instead of being passed to f.
27 #endif