__emit: Issue an error if the stack offset/data address is not a multiple of cell size
This commit is contained in:
parent
4c0536989e
commit
4c8d56c511
@ -6221,7 +6221,6 @@ static void SC_FASTCALL emit_param_data(emit_outval *p)
|
|||||||
tok=lex(&val,&str);
|
tok=lex(&val,&str);
|
||||||
switch (tok) {
|
switch (tok) {
|
||||||
case tNUMBER:
|
case tNUMBER:
|
||||||
p->value.ucell=(ucell)val;
|
|
||||||
break;
|
break;
|
||||||
case tSYMBOL:
|
case tSYMBOL:
|
||||||
sym=findloc(str);
|
sym=findloc(str);
|
||||||
@ -6239,7 +6238,7 @@ static void SC_FASTCALL emit_param_data(emit_outval *p)
|
|||||||
sym=findglb(str,sSTATIC);
|
sym=findglb(str,sSTATIC);
|
||||||
if (sym==NULL) {
|
if (sym==NULL) {
|
||||||
error(17,str); /* undefined symbol */
|
error(17,str); /* undefined symbol */
|
||||||
break;
|
return;
|
||||||
} /* if */
|
} /* if */
|
||||||
markusage(sym,uREAD | uWRITTEN);
|
markusage(sym,uREAD | uWRITTEN);
|
||||||
if (sym->ident==iFUNCTN || sym->ident==iREFFUNC) {
|
if (sym->ident==iFUNCTN || sym->ident==iREFFUNC) {
|
||||||
@ -6247,12 +6246,17 @@ static void SC_FASTCALL emit_param_data(emit_outval *p)
|
|||||||
goto invalid_token;
|
goto invalid_token;
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
p->value.ucell=(ucell)sym->addr;
|
val=sym->addr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
invalid_token:
|
invalid_token:
|
||||||
emit_invalid_token(teDATA,tok);
|
emit_invalid_token(teDATA,tok);
|
||||||
|
return;
|
||||||
} /* switch */
|
} /* switch */
|
||||||
|
if ((val % sizeof(cell))==0)
|
||||||
|
p->value.ucell=(ucell)val;
|
||||||
|
else
|
||||||
|
error(11); /* must be a multiple of cell size */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_param_local(emit_outval *p)
|
static void SC_FASTCALL emit_param_local(emit_outval *p)
|
||||||
@ -6266,7 +6270,6 @@ static void SC_FASTCALL emit_param_local(emit_outval *p)
|
|||||||
tok=lex(&val,&str);
|
tok=lex(&val,&str);
|
||||||
switch (tok) {
|
switch (tok) {
|
||||||
case tNUMBER:
|
case tNUMBER:
|
||||||
p->value.ucell=(ucell)val;
|
|
||||||
break;
|
break;
|
||||||
case tSYMBOL:
|
case tSYMBOL:
|
||||||
sym=findloc(str);
|
sym=findloc(str);
|
||||||
@ -6285,18 +6288,23 @@ static void SC_FASTCALL emit_param_local(emit_outval *p)
|
|||||||
if (sym==NULL) {
|
if (sym==NULL) {
|
||||||
undefined_sym:
|
undefined_sym:
|
||||||
error(17,str); /* undefined symbol */
|
error(17,str); /* undefined symbol */
|
||||||
break;
|
return;
|
||||||
} /* if */
|
} /* if */
|
||||||
markusage(sym,uREAD | uWRITTEN);
|
markusage(sym,uREAD | uWRITTEN);
|
||||||
if (sym->ident!=iCONSTEXPR)
|
if (sym->ident!=iCONSTEXPR)
|
||||||
goto undefined_sym;
|
goto undefined_sym;
|
||||||
} /* if */
|
} /* if */
|
||||||
p->value.ucell=(ucell)sym->addr;
|
val=sym->addr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
invalid_token:
|
invalid_token:
|
||||||
emit_invalid_token(tSYMBOL,tok);
|
emit_invalid_token(tSYMBOL,tok);
|
||||||
|
return;
|
||||||
} /* switch */
|
} /* switch */
|
||||||
|
if ((val % sizeof(cell))==0)
|
||||||
|
p->value.ucell = (ucell)val;
|
||||||
|
else
|
||||||
|
error(11); /* must be a multiple of cell size */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_param_label(emit_outval *p)
|
static void SC_FASTCALL emit_param_label(emit_outval *p)
|
||||||
|
@ -50,7 +50,7 @@ static char *errmsg[] = {
|
|||||||
/*008*/ "must be a constant expression; assumed zero\n",
|
/*008*/ "must be a constant expression; assumed zero\n",
|
||||||
/*009*/ "invalid array size (negative, zero or out of bounds)\n",
|
/*009*/ "invalid array size (negative, zero or out of bounds)\n",
|
||||||
/*010*/ "invalid function or declaration\n",
|
/*010*/ "invalid function or declaration\n",
|
||||||
/*011*/ "invalid outside functions\n",
|
/*011*/ "stack offset/data address must be a multiple of cell size\n",
|
||||||
/*012*/ "invalid function call, not a valid address\n",
|
/*012*/ "invalid function call, not a valid address\n",
|
||||||
/*013*/ "no entry point (no public functions)\n",
|
/*013*/ "no entry point (no public functions)\n",
|
||||||
/*014*/ "invalid statement; not in switch\n",
|
/*014*/ "invalid statement; not in switch\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user