[cc65] Problem with multidimensional arrays

From: thefox xofeht <thefox1aspekt.fi>
Date: 2012-03-24 10:29:21
Hello everybody,

Why does "foo" get added to DATA segment in the following code? ("bar"
goes to RODATA as expected.)

const unsigned char foo[][ 3 ] = {
    { 1,2,3 },
    { 4,5,6 }
};

const unsigned char bar[ 6 ] = {
    1, 2, 3, 4, 5, 6
};

Compiled with: cl65 -c --listing foo.lst -o foo.o foo.c

I'm using the latest snapshot. Here's the corresponding listing:

000000r 1               .segment	"DATA"
000000r 1
000000r 1               _foo:
000000r 1  01           	.byte	$01
000001r 1  02           	.byte	$02
000002r 1  03           	.byte	$03
000003r 1  04           	.byte	$04
000004r 1  05           	.byte	$05
000005r 1  06           	.byte	$06
000006r 1
000006r 1               .segment	"RODATA"
000000r 1
000000r 1               _bar:
000000r 1  01           	.byte	$01
000001r 1  02           	.byte	$02
000002r 1  03           	.byte	$03
000003r 1  04           	.byte	$04
000004r 1  05           	.byte	$05
000005r 1  06           	.byte	$06
000006r 1
000006r 1

-thefox
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Mar 24 10:29:36 2012

This archive was generated by hypermail 2.1.8 : 2012-03-24 10:29:40 CET