1
0
Fork 0
forked from fte/fteqw

Moved a chunk of code. This will prevent the temp from a calculation in the argument from overwriting the actual return value. a()+b(c+d) should now compile fine.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2490 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2007-04-11 22:45:34 +00:00
parent e6c12cc324
commit 451b8ccc79

View file

@ -2526,6 +2526,20 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could
else
np = t->num_parms;
if (def_ret.temp->used)
{
old = QCC_GetTemp(def_ret.type);
if (def_ret.type->size == 3)
QCC_FreeTemp(QCC_PR_Statement(&pr_opcodes[OP_STORE_V], &def_ret, old, NULL));
else
QCC_FreeTemp(QCC_PR_Statement(&pr_opcodes[OP_STORE_F], &def_ret, old, NULL));
QCC_UnFreeTemp(old);
QCC_UnFreeTemp(&def_ret);
QCC_PR_ParseWarning(WARN_FIXEDRETURNVALUECONFLICT, "Return value conflict - output is inefficient");
}
else
old = NULL;
if (opt_vectorcalls && (t->num_parms == 1 && t->param->type == ev_vector))
{ //if we're using vectorcalls
//if it's a function, takes a vector
@ -2750,20 +2764,6 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could
}
}
if (def_ret.temp->used)
{
old = QCC_GetTemp(def_ret.type);
if (def_ret.type->size == 3)
QCC_FreeTemp(QCC_PR_Statement(&pr_opcodes[OP_STORE_V], &def_ret, old, NULL));
else
QCC_FreeTemp(QCC_PR_Statement(&pr_opcodes[OP_STORE_F], &def_ret, old, NULL));
QCC_UnFreeTemp(old);
QCC_UnFreeTemp(&def_ret);
QCC_PR_ParseWarning(WARN_FIXEDRETURNVALUECONFLICT, "Return value conflict - output is inefficient");
}
else
old = NULL;
if (strchr(func->name, ':') && laststatement && statements[laststatement-1].op == OP_LOAD_FNC && statements[laststatement-1].c == func->ofs)
{ //we're entering C++ code with a different self.