mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- fixed: A preincrement of a local variable generated wrong code if passed as a function parameter.
Due to the special nature of this expression the code generator got stuck in 'address' mode and passed the address of the variable instead of its value.
This commit is contained in:
parent
685e5c1e95
commit
bcc8972356
1 changed files with 11 additions and 1 deletions
|
@ -2304,6 +2304,7 @@ ExpEmit FxPreIncrDecr::Emit(VMFunctionBuilder *build)
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer.Free(build);
|
pointer.Free(build);
|
||||||
|
value.Target = false; // This is for 'unrequesting' the address of a register variable. If not done here, passing a preincrement expression to a function will generate bad code.
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7406,7 +7407,16 @@ ExpEmit FxArrayElement::Emit(VMFunctionBuilder *build)
|
||||||
|
|
||||||
if (arrayispointer)
|
if (arrayispointer)
|
||||||
{
|
{
|
||||||
arraytype = static_cast<PArray*>(Array->ValueType->toPointer()->PointedType);
|
auto ptr = Array->ValueType->toPointer();
|
||||||
|
if (ptr != nullptr)
|
||||||
|
{
|
||||||
|
arraytype = static_cast<PArray*>(ptr->PointedType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ScriptPosition.Message(MSG_ERROR, "Internal error when generating code for array access");
|
||||||
|
return ExpEmit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue