The function parameter when calling func1() is not pushed completely onto the stack. Only one byte is pushed instead of the full 4 bytes that make up the unsigned long function parameter. See also the attached file sdcc_z80_subpar.asm lines 54 to 59.
Function calls to func2(), func3() and func4() are staffed properly.
----------8<---------------
void func1(unsigned long);
void func2(unsigned long);
void func3(unsigned long);
void func4(unsigned long);
void main (void)
{
unsigned long param;
func1(param = 0);
func2(param = 1L);
func3(param);
func4(0);
}
----------8<---------------
Compiled with
$ sdcc -v
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.6.3 #4543 (Feb 20 2007) (UNIX)
$ sdcc -mz80 -c sdcc_z80_subpar.c
Compiled assembler output
Logged In: YES
user_id=888171
Originator: NO
Please try again with the latest sources from subversion as this was probably fixed in SDCC 2.6.4 #4631. And please report back with the results or to inform you could not perform this.
Logged In: YES
user_id=156321
Originator: YES
Compiled the file with
$ sdcc -v
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.6.4 #4640 (Feb 23 2007) (UNIX)
The resulting assembler code looks ok now.
Thanks for the quick response!