Menu

#65 Error in Z80 code generation

closed-works-for-me
z80 port (189)
5
2013-05-25
2001-05-23
Anonymous
No

I can't compile this file properly with SDCC Z80 port:

typedef struct {
unsigned char year; /* Current
year (with offset 1900) */
unsigned char month; /* Month (1 =
Jan., ..., 12 = Dec.) */
unsigned char day; /* Day of
month (1 to 31) */
} DATE_STRUCT;

unsigned char year;
unsigned char month;
unsigned char day;

void *main()
{
float i;
float y;
void *p;
DATE_STRUCT d;
DATE_STRUCT *date_ptr;

date_ptr = &d;

year = date_ptr->year;
month = date_ptr->month;
day = date_ptr->day;

i = 1.35;
i += 2;
y = 1;
y = y+i;
i = y;
p = &y;
return p;
}
SDCC generates wrong instruction on 99 & 110 line of
asm listing !!!

Discussion

  • Johan Knol

    Johan Knol - 2001-05-25
    • assigned_to: nobody --> michaelh
     
  • Michael Hope

    Michael Hope - 2001-07-21
    • status: open --> closed-works-for-me
     
  • Michael Hope

    Michael Hope - 2001-07-21

    Logged In: YES
    user_id=373

    The asm in sdcc-20010720 looks OK to me. Note that all
    references to i and y are optimised out, so that only the
    struct assigns and the final value of y are setup. Note
    also that you are returning the address of a local
    variable.

     

Log in to post a comment.