Fix post-inc return values, oops. Bug reported by OneManClan.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4736 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-08-29 11:33:11 +00:00
parent 3ee2712c3c
commit da0473bf5e
1 changed files with 3 additions and 4 deletions

View File

@ -6404,14 +6404,13 @@ QCC_def_t *QCC_RefToDef(QCC_ref_t *ref, pbool freetemps)
QCC_def_t *ret = ref->base;
if (ref->postinc)
{
QCC_def_t *origv;
int inc = ref->postinc;
ref->postinc = 0;
//read the value, without preventing the store later
ret = QCC_RefToDef(ref, false);
//archive off the old value
tmp = QCC_GetTemp(ret->type);
origv = QCC_CollapseStore(tmp, ret, ret->type, true, !freetemps);
QCC_StoreToDef(tmp, ret, ret->type, false, true);
ret = tmp;
//update the value
switch(ref->cast->type)
@ -6432,11 +6431,11 @@ QCC_def_t *QCC_RefToDef(QCC_ref_t *ref, pbool freetemps)
}
//hack any following uses of the ref to refer to the temp
ref->type = REF_GLOBAL;
ref->base = origv;
ref->base = ret;
ref->index = NULL;
ref->readonly = true;
return origv;
return ret;
}
switch(ref->type)