From 8eabaf61c9118da423121d648201ba7c3240f2a8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 3 Aug 2022 08:45:37 +0200 Subject: [PATCH] - version-restrict int to uint promotion. Some mods depend on this not happening. --- src/common/scripting/backend/codegen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index 04fdfe22d..c8136fbac 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -2686,13 +2686,13 @@ bool FxBinary::Promote(FCompileContext &ctx, bool forceint) ValueType = TypeUInt32; } // If one side is an unsigned 32-bit int and the other side is a signed 32-bit int, the signed side is implicitly converted to unsigned. - else if (!ctx.FromDecorate && left->ValueType == TypeUInt32 && right->ValueType == TypeSInt32) + else if (!ctx.FromDecorate && left->ValueType == TypeUInt32 && right->ValueType == TypeSInt32 && ctx.Version >= MakeVersion(4, 9, 0)) { right = new FxIntCast(right, false, false, true); right = right->Resolve(ctx); ValueType = TypeUInt32; } - else if (!ctx.FromDecorate && left->ValueType == TypeSInt32 && right->ValueType == TypeUInt32) + else if (!ctx.FromDecorate && left->ValueType == TypeSInt32 && right->ValueType == TypeUInt32 && ctx.Version >= MakeVersion(4, 9, 0)) { left = new FxIntCast(left, false, false, true); left = left->Resolve(ctx);