[cc65] structure bug?

Date view Thread view Subject view

From: Mark Keates (markk_at_dendrite.co.uk)
Date: 2001-05-24 12:28:41


Have a look at this code at the end of this post.

If I compile it to assembler then I get 'my_z' as:

_my_z:
        .word   $0001
        .word   _my_x+0
        .word   _my_y+0

If I change the addresses in 'my_z' as follows:

struct z my_z = {
	1, my_x-2, my_y-2
};

It produces:

_my_z:
        .word   $0001
        .word   $FFF8
        .word   $FFF4

Is this a bug?

Thanks,

Mark

-- snip --

struct x 
{
	int a;
	int b;
};

struct y
{
	int r;
	int s;
	int t;
};

struct z
{
	int i;
	struct x *j;
	struct y *k;
};

struct x my_x[2] = {
	{ 1, 1 },
	{ 2, 2 }
};

struct y my_y[3] = {
	{ 9, 9, 9 },
	{ 8, 8, 8 },
	{ 7, 7, 7 }
};

struct z my_z = {
	1,my_x,	my_y
};

int main(void)
{
	int i;
	i = my_z.i;
}

----------------------------------------------------------------------
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 : 2001-12-14 22:05:40 CET