From 8e11f682d6bb86694af7c7611727dd8e9dba2955 Mon Sep 17 00:00:00 2001 From: Marcin Misiurski Date: Wed, 25 Mar 2015 14:19:10 +0100 Subject: [PATCH] Fix enum field size (credit to @Arkshine) --- source/compiler/sc2.c | 2 +- source/compiler/sc3.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index 93d321e..455d1b7 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -2948,7 +2948,7 @@ SC_FUNC symbol *addvariable(const char *name,cell addr,int ident,int vclass,int * the symbol without states if no symbol with states exists). */ assert(vclass!=sGLOBAL || (sym=findglb(name,sGLOBAL))==NULL || (sym->usage & uDEFINE)==0 - || sym->ident==iFUNCTN && sym==curfunc + || (sym->ident==iFUNCTN && sym==curfunc) || sym->states==NULL && sc_curstates>0); if (ident==iARRAY || ident==iREFARRAY) { diff --git a/source/compiler/sc3.c b/source/compiler/sc3.c index fa2f771..375c105 100644 --- a/source/compiler/sc3.c +++ b/source/compiler/sc3.c @@ -2195,7 +2195,7 @@ static int nesting=0; error(47); /* array sizes must match */ } /* if */ } /* if */ - if (lval.ident!=iARRAYCELL) { + if (lval.ident!=iARRAYCELL || lval.constval > 0) { /* save array size, for default values with uSIZEOF flag */ cell array_sz=lval.constval; assert(array_sz!=0);/* literal array must have a size */