X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Flocals.c;h=710d05e33a34a7442bbaee93f432246fd2c08378;hb=112ae0e3db511ddd92e769c11328646ebe2a6240;hp=be5c09970c5f427225057cb64840665706adf621;hpb=7687489a08d40295ed3401caaca2b40256668620;p=cc65 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);