From: uz Date: Thu, 27 May 2010 19:47:13 +0000 (+0000) Subject: Fix the check for constant static local data, which was wrong when the data X-Git-Tag: V2.13.3~759 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=64b597017acaebb97ed1949ce7d9b304b1baad2d;p=cc65 Fix the check for constant static local data, which was wrong when the data was an array. It should go into RODATA, not DATA. git-svn-id: svn://svn.cc65.org/cc65/trunk@4669 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/locals.c b/src/cc65/locals.c index be5c09970..710d05e33 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -355,8 +355,12 @@ static unsigned ParseStaticDecl (Declaration* Decl, unsigned* SC) /* Static data */ if (CurTok.Tok == TOK_ASSIGN) { - /* Initialization ahead, switch to data segment and define a label */ - if (IsQualConst (Decl->Type)) { + /* Initialization ahead, switch to data segment and define a label. + * For arrays, we need to check the elements of the array for + * constness, not the array itself. + */ + if (IsQualConst (Decl->Type) || + (IsTypeArray (Decl->Type) && IsQualConst (GetElementType (Decl->Type)))) { SymData = AllocLabel (g_userodata); } else { SymData = AllocLabel (g_usedata);