2 bug-3283.c. On z80, a variable allocated to iy was overwritten by the use of iy for an address at a cast.
7 #pragma disable_warning 85
9 typedef struct object_d
{
12 unsigned int position
;
13 unsigned char attributes
;
18 unsigned char current_position
;
23 extern object
*search_object_p(unsigned int o
);
24 extern void show_message(const char *m
);
26 unsigned char get(unsigned int o
)
28 odummy
=search_object_p(o
); // odummy in iy.
29 if(odummy
->position
!=current_position
) { // a cast from unsigned char to unsigned int here used iy to point to current_position.
30 show_message(message1006
);
31 } else if((odummy
->attributes
&1)==0) {
32 show_message(message1005
);
34 odummy
->position
=1500; // odummy used again here.
40 object obj
= {0, 0, 0, 1};
46 ASSERT(obj
.position
==1500);
49 object
*search_object_p(unsigned int o
)
54 void show_message(const char *m
)