[cc65] possible bug?

Date view Thread view Subject view

From: groepaz (groepaz_at_gmx.net)
Date: 2002-02-23 16:25:23


ok i _think_ this is a bug connected to assignment operator and/or
casting.... automatic sign-extension broken?!

; asm routine:

signedsin:  .byte $80,...

_SINUS:
            tax
            lda signedsin,x
            ; func returns "char" so we silently forget about
            ; putting 0 to X....
            rts

// c-code:
            
signed char SINUS(signed char a);

void main(){
signed char a;
int b;
            a=SINUS(0);
            printf("%04x\n",a);    // prints "0080", ok
            b=(int)SINUS(0);
            printf("%04x\n",b);    // prints "0080", error
                                   // should be "ff80"

}

in other words, if a (asm-) function that is declared "signed char" is
called and the value casted to an int, shouldnt the COMPILER generate
necessary code to do the required sign-extension? (it works ok ofcoz
if i add that myself to the asm routine, but i really dont like the
idea to cram code here and there that in most cases isnt used anyway)

-- 
Best regards,
 groepaz                            mailto:groepaz_at_gmx.net


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-02-23 16:25:52 CET