From 7cd89fe07b5511bdc2798681291ccc54f71bc9f4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 16 Nov 2018 11:21:51 +0100 Subject: [PATCH] - fixed: FxUnaryNotBitwise modified the source operand instead of allocating a new one. --- src/scripting/backend/codegen.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 015bae2d0..921a438ed 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -2058,10 +2058,12 @@ ExpEmit FxUnaryNotBitwise::Emit(VMFunctionBuilder *build) { assert(Operand->ValueType->GetRegType() == REGT_INT); ExpEmit from = Operand->Emit(build); + from.Free(build); + ExpEmit to(build, REGT_INT); assert(!from.Konst); - // Do it in-place. - build->Emit(OP_NOT, from.RegNum, from.RegNum, 0); - return from; + + build->Emit(OP_NOT, to.RegNum, from.RegNum, 0); + return to; } //==========================================================================