Menu

#1297 Z80: Function parameter not completely pushed onto stack

closed-duplicate
z80 port (189)
5
2013-05-25
2007-02-22
No

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

Discussion

  • Arnim Läuger

    Arnim Läuger - 2007-02-22

    Compiled assembler output

     
  • Maarten Brock

    Maarten Brock - 2007-02-22

    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.

     
  • Maarten Brock

    Maarten Brock - 2007-02-22
    • milestone: --> fixed
    • assigned_to: nobody --> maartenbrock
    • status: open --> pending-duplicate
     
  • Arnim Läuger

    Arnim Läuger - 2007-02-22
    • status: pending-duplicate --> open-duplicate
     
  • Arnim Läuger

    Arnim Läuger - 2007-02-22

    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!

     
  • Maarten Brock

    Maarten Brock - 2007-02-23
    • status: open-duplicate --> closed-duplicate
     

Log in to post a comment.