Compiler: Prevent declaring arrays that the compiler is too buggy to handle
AM Bug 7977: https://bugs.alliedmods.net/show_bug.cgi?id=4977
This commit is contained in:
parent
f710188c86
commit
41dfdc7f59
@ -2202,6 +2202,23 @@ static void initials2(int ident,int tag,cell *size,int dim[],int numdim,
|
||||
eq_match_override = matchtoken('=');
|
||||
}
|
||||
|
||||
if (numdim > 2) {
|
||||
int d, hasEmpty = 0;
|
||||
for (d = 0; d < numdim; d++) {
|
||||
if (dim[d] == 0)
|
||||
hasEmpty++;
|
||||
}
|
||||
/* Work around ambug 4977 where indirection vectors are computed wrong. */
|
||||
if (hasEmpty && hasEmpty < numdim-1 && dim[numdim-1]) {
|
||||
error(112);
|
||||
/* This will assert with something like [2][][256] from a separate bug.
|
||||
* To prevent this assert, automatically wipe the rest of the dims.
|
||||
*/
|
||||
for (d = 0; d < numdim - 1; d++)
|
||||
dim[d] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!eq_match_override) {
|
||||
assert(ident!=iARRAY || numdim>0);
|
||||
if (ident==iARRAY && dim[numdim-1]==0) {
|
||||
|
@ -129,6 +129,7 @@ static char *fatalmsg[] = {
|
||||
/*109*/ "invalid path: \"%s\"\n",
|
||||
/*110*/ "assertion failed: %s\n",
|
||||
/*111*/ "user error: %s\n",
|
||||
/*112*/ "specify either all dimensions or only the last dimension\n"
|
||||
};
|
||||
|
||||
static char *warnmsg[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user