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 !!!
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.