diff --git a/source/compiler/sc3.c b/source/compiler/sc3.c index cc86bfa..c3d9584 100644 --- a/source/compiler/sc3.c +++ b/source/compiler/sc3.c @@ -2214,19 +2214,23 @@ static int nesting=0; if (lval.sym==NULL || lval.ident==iARRAYCELL) { if (arg[argidx].numdim!=1) { error(48); /* array dimensions must match */ - } else if (arg[argidx].dim[0]!=0) { - assert(arg[argidx].dim[0]>0); - if (lval.ident==iARRAYCELL) { - error(47); /* array sizes must match */ - } else { - assert(lval.constval!=0); /* literal array must have a size */ - /* A literal array must have exactly the same size as the - * function argument; a literal string may be smaller than - * the function argument. - */ - if ((lval.constval>0 && arg[argidx].dim[0]!=lval.constval) - || (lval.constval<0 && arg[argidx].dim[0] < -lval.constval)) - error(47); /* array sizes must match */ + } else { + if (lval.sym==NULL && (arg[argidx].usage & uCONST)==0) + error(239); + if (arg[argidx].dim[0]!=0) { + assert(arg[argidx].dim[0]>0); + if (lval.ident==iARRAYCELL) { + error(7); /* array sizes must match */ + } else { + assert(lval.constval!=0); /* literal array must have a size */ + /* A literal array must have exactly the same size as the + * function argument; a literal string may be smaller than + * the function argument. + */ + if ((lval.constval>0 && arg[argidx].dim[0]!=lval.constval) + || (lval.constval<0 && arg[argidx].dim[0]<-lval.constval)) + error(47); /* array sizes must match */ + } /* if */ } /* if */ } /* if */ if (lval.ident!=iARRAYCELL || lval.constval > 0) { diff --git a/source/compiler/sc5.c b/source/compiler/sc5.c index 3f91485..9979d90 100644 --- a/source/compiler/sc5.c +++ b/source/compiler/sc5.c @@ -192,7 +192,8 @@ static char *warnmsg[] = { /*235*/ "public function lacks forward declaration (symbol \"%s\")\n", /*236*/ "unknown parameter in substitution (incorrect #define pattern)\n", /*237*/ "user warning: %s\n", -/*238*/ "meaningless combination of class specifiers (%s)\n" +/*238*/ "meaningless combination of class specifiers (%s)\n", +/*239*/ "literal array/string passed to a non-const parameter\n" }; #define NUM_WARNINGS (sizeof warnmsg / sizeof warnmsg[0])