Re: [cc65] Dodgy long constant passing?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2005-05-04 10:51:10
Hi!

On Wed, May 04, 2005 at 04:27:42AM +0100, dominic beesley wrote:
> I seem to have narrowed it down to the following bit of code generation:
>
> ;
> ; fsz = lseek(fd, 0, SEEK_END);
> ;
>        ldy     #$01
>        jsr     ldaxysp
>        jsr     pushax
>        ldx     #$00
>        lda     #$00
>        jsr     pushax
>        ldx     #$00
>        lda     #$01    <------------wrong???!??!
>        jsr     pushax
>        ldy     #$06
>        jsr     _lseek
>        jsr     axlong
>        ldy     #$02
>        jsr     steaxysp
>
>
> lseek is defined as:
>
> off_t __fastcall__ lseek(int fd, off_t offset, int whence);

The generated code looks as if you're calling lseek without a prototype. The
call sequence doesn't match the prototype, it matches

        int lseek ();

instead. So

        fsz = lseek(fd, 0, SEEK_END);

is translated to a call

        int = lseek (int, int, int);

instead of

        long = lseek (int, long, int);

If you are definitely sure that a prototype is present, please send me a
short(!) example that translates to the above code. Otherwise, please fix your
code.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed May 4 10:51:18 2005

This archive was generated by hypermail 2.1.8 : 2005-05-04 10:51:20 CEST