mirror of
https://github.com/ZDoom/acc.git
synced 2024-11-15 00:41:30 +00:00
Fix for generating incorrect code for accessing arrays with three or more dimensions.
SVN r15 (trunk)
This commit is contained in:
parent
56f3ff15d8
commit
23b23f3950
3 changed files with 12 additions and 8 deletions
2
Makefile
2
Makefile
|
@ -16,7 +16,7 @@ endif
|
|||
|
||||
CFLAGS = -Os -Wall -W -march=pentium -mtune=athlon-4 -fomit-frame-pointer
|
||||
LDFLAGS = -s
|
||||
VERNUM = 136
|
||||
VERNUM = 137
|
||||
|
||||
OBJS = \
|
||||
acc.o \
|
||||
|
|
2
acc.c
2
acc.c
|
@ -22,7 +22,7 @@
|
|||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
#define VERSION_TEXT "1.36"
|
||||
#define VERSION_TEXT "1.37"
|
||||
#define COPYRIGHT_YEARS_TEXT "1995"
|
||||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
|
16
parse.c
16
parse.c
|
@ -882,7 +882,7 @@ static void OuterFunction(void)
|
|||
static void OuterMapVar(boolean local)
|
||||
{
|
||||
symbolNode_t *sym = NULL;
|
||||
int index;
|
||||
int index, i;
|
||||
|
||||
MS_Message(MSG_DEBUG, "---- %s ----\n", local ? "LeadingStaticVarDeclare" : "OuterMapVar");
|
||||
do
|
||||
|
@ -993,8 +993,6 @@ static void OuterMapVar(boolean local)
|
|||
sym->info.array.size = size;
|
||||
if(ndim > 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
sym->info.array.dimensions[ndim-1] = 1;
|
||||
for(i = ndim - 2; i >= 0; --i)
|
||||
{
|
||||
|
@ -1002,6 +1000,12 @@ static void OuterMapVar(boolean local)
|
|||
sym->info.array.dimensions[i+1] * dims[i+1];
|
||||
}
|
||||
}
|
||||
MS_Message(MSG_DEBUG, " - with multipliers ");
|
||||
for(i = 0; i < ndim; ++i)
|
||||
{
|
||||
MS_Message(MSG_DEBUG, "[%d]", sym->info.array.dimensions[i]);
|
||||
}
|
||||
MS_Message(MSG_DEBUG, "\n");
|
||||
if(tk_Token == TK_ASSIGN)
|
||||
{
|
||||
InitializeArray(sym, dims, size);
|
||||
|
@ -3693,12 +3697,12 @@ static void ParseArrayIndices(symbolNode_t *sym, int requiredIndices)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(i > 0)
|
||||
EvalExpression();
|
||||
if(i < sym->info.array.ndim - 1)
|
||||
{
|
||||
PC_AppendPushVal(sym->info.array.dimensions[i-1]);
|
||||
PC_AppendPushVal(sym->info.array.dimensions[i]);
|
||||
PC_AppendCmd(PCD_MULTIPLY);
|
||||
}
|
||||
EvalExpression();
|
||||
if(i > 0)
|
||||
{
|
||||
PC_AppendCmd(PCD_ADD);
|
||||
|
|
Loading…
Reference in a new issue