[cc65] Another bug... ?

Date view Thread view Subject view

From: groepaz (groepaz_at_gmx.net)
Date: 2002-07-18 16:05:03


whoppa.... like always, when there's just a tiny bit left to fix some
compiler bug pops up :=DDD

look at this, problem is a case value of "0x8000" (min_int) used in a
switch statement where the switch is done by a signed int. (mmmh and
its weird to me that 0x8000 and -32768 are threated differently ...
sth with signed vs unsigned conversion looks fux0red here.....0xffff
vs -1 shouldnt make a difference at this point either eh?)

#include <stdio.h>

int main(void) {
int i;

        switch(i) {

                case -1:        // works
                // case 0xffff: // 'range error' (-1)

                // max int

                // case 0x7fff:            // works
                case 32767:                // works
                // case 32768:             // 'range error' (correct for that one!)

                // min int

                case -32768:               // 'warning. constant is long'
                // case 0x8000:        // 'range error'
                // case -32769:            // 'range error' (correct for that one!)
                        printf("testing\n");
                        break;
        }

    /* return OK */
    return(0);

}

-- 
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-07-18 16:06:39 CEST