diff --git a/source/compiler/sc1.c b/source/compiler/sc1.c index 4f1d7bc..de4796a 100644 --- a/source/compiler/sc1.c +++ b/source/compiler/sc1.c @@ -4907,9 +4907,20 @@ static int testsymbols(symbol *root,int level,int testlabs,int testconst) error(204,sym->name); /* value assigned to symbol is never used */ errorset(sSETPOS,-1); } else if ((sym->usage & (uWRITTEN | uPUBLIC | uCONST))==0 && sym->ident==iREFARRAY) { - errorset(sSETPOS,sym->lnumber); - error(214,sym->name); /* make array argument "const" */ - errorset(sSETPOS,-1); + int warn = 1; + symbol* depend = finddepend(sym); + while (depend != NULL) { + if ((depend->usage & (uWRITTEN | uPUBLIC | uCONST)) != 0) { + warn = 0; + break; + } + depend = finddepend(depend); + } /* while */ + if (warn) { + errorset(sSETPOS, sym->lnumber); + error(214, sym->name); /* make array argument "const" */ + errorset(sSETPOS, -1); + } /* if */ } /* if */ /* also mark the variable (local or global) to the debug information */ if ((sym->usage & (uWRITTEN | uREAD))!=0 && (sym->usage & uNATIVE)==0)