1 /* Test parameters for functions that use a large stack for local variables.
2 There is apotential a bug where the stack adjustment at function entry overwrites register parameters.
3 To reproduce, we need a large stack (so registers are used for stack adjustment), and
4 parameters that are small enough to be allocated to registers, but big enough that these
5 registers have the smae width as teh stack pointer.
7 type1: unsigned char, unsigned int, unsigned long
8 type2: unsigned char, unsigned int, unsigned long
13 volatile {type1
} int1
;
14 volatile {type2
} int2
;
18 #elif defined (__SDCC_pdk15) || defined (__SDCC_mcs51) || defined (__SDCC_mos6502) || defined (__SDCC_mos65c02)
21 #define ARRAYSIZE 780 // Needs to be bigger than 266 to reliably trigger conditions for stm8, also sufficient for z80
24 void g(unsigned char *);
26 void f({type1
} par1
, {type2
} par2
)
28 unsigned char array
[ARRAYSIZE
];
32 ASSERT(array
[0] == 0 && array
[ARRAYSIZE
- 1] == (unsigned char)(ARRAYSIZE
- 1));
35 void g(unsigned char *array
)
37 array
[0] = 0; array
[ARRAYSIZE
- 1] = (unsigned char)(ARRAYSIZE
- 1);
44 ASSERT (int1
== ({type1
})23);
45 ASSERT (int2
== ({type2
})42);
46 f(0xa5a5a5, 0x5a5a5a);
47 ASSERT (int1
== ({type1
})0xa5a5a5);
48 ASSERT (int2
== ({type2
})0x5a5a5a);