From: uz Date: Thu, 20 Aug 2009 10:55:38 +0000 (+0000) Subject: Fixed a bug reported by Greg King: Initialized data for constant arrays was X-Git-Tag: V2.13.0rc1~211 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4a93f188a09cb6633c8f2f6c7235f0e0c63e8795;p=cc65 Fixed a bug reported by Greg King: Initialized data for constant arrays was not placed in the RODATA but in the DATA segment. git-svn-id: svn://svn.cc65.org/cc65/trunk@4044 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/compile.c b/src/cc65/compile.c index 2e6acadd1..c51191885 100644 --- a/src/cc65/compile.c +++ b/src/cc65/compile.c @@ -192,9 +192,14 @@ static void Parse (void) } } - /* Switch to the data or rodata segment */ - if (IsQualConst (Decl.Type)) { - g_userodata (); + /* Switch to the data or rodata segment. For arrays, check + * the element qualifiers, since not the array but its + * elements are const. + */ + if (IsQualConst (Decl.Type) || + (IsTypeArray (Decl.Type) && + IsQualConst (GetElementType (Decl.Type)))) { + g_userodata (); } else { g_usedata (); }