mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- fixed: The conditional operator could clobber a local variable if it was the result of the true expression.
This commit is contained in:
parent
1a16f664e4
commit
e7cd5ec2bb
1 changed files with 12 additions and 2 deletions
|
@ -208,6 +208,10 @@ ExpEmit::ExpEmit(VMFunctionBuilder *build, int type, int count)
|
|||
|
||||
void ExpEmit::Free(VMFunctionBuilder *build)
|
||||
{
|
||||
if (RegType == REGT_INT && RegNum == 0)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
if (!Fixed && !Konst && RegType <= REGT_TYPE)
|
||||
{
|
||||
build->Registers[RegType].Return(RegNum, RegCount);
|
||||
|
@ -4584,8 +4588,14 @@ ExpEmit FxConditional::Emit(VMFunctionBuilder *build)
|
|||
else
|
||||
{
|
||||
// Use the register returned by the true condition as the
|
||||
// target for the false condition.
|
||||
out = trueop;
|
||||
// target for the false condition, if temporary.
|
||||
// If this is a local variable we need another register for the result.
|
||||
if (trueop.Fixed)
|
||||
{
|
||||
out = ExpEmit(build, trueop.RegType);
|
||||
build->Emit(truex->ValueType->GetMoveOp(), out.RegNum, trueop.RegNum, 0);
|
||||
}
|
||||
else out = trueop;
|
||||
}
|
||||
}
|
||||
// Make sure to skip the false path.
|
||||
|
|
Loading…
Reference in a new issue