From 1ba1dcfc095172ceff57781ffee862a00e42f223 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 30 Aug 2024 12:54:59 +0200 Subject: [PATCH] wasm gc: fix issue in type inference for comparison instruction result --- .../java/org/teavm/model/analysis/BaseTypeInference.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/org/teavm/model/analysis/BaseTypeInference.java b/core/src/main/java/org/teavm/model/analysis/BaseTypeInference.java index 495c719c4..62ce3840a 100644 --- a/core/src/main/java/org/teavm/model/analysis/BaseTypeInference.java +++ b/core/src/main/java/org/teavm/model/analysis/BaseTypeInference.java @@ -30,6 +30,7 @@ import org.teavm.model.instructions.AbstractInstructionVisitor; import org.teavm.model.instructions.ArrayLengthInstruction; import org.teavm.model.instructions.AssignInstruction; import org.teavm.model.instructions.BinaryInstruction; +import org.teavm.model.instructions.BinaryOperation; import org.teavm.model.instructions.BoundCheckInstruction; import org.teavm.model.instructions.CastInstruction; import org.teavm.model.instructions.CastIntegerInstruction; @@ -365,6 +366,10 @@ public abstract class BaseTypeInference { @Override public void visit(BinaryInstruction insn) { + if (insn.getOperation() == BinaryOperation.COMPARE) { + type(insn.getReceiver(), ValueType.INTEGER); + return; + } type(insn.getReceiver(), insn.getOperandType()); }