From d4537819f10404d2a0e1a8b4098981b0e0491bf5 Mon Sep 17 00:00:00 2001 From: "M.Schmidt" Date: Fri, 22 Dec 2023 14:32:53 +0100 Subject: [PATCH] fix merging outputLocals when they are the same Local --- .../sootup/java/bytecode/frontend/OperandMerging.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sootup.java.bytecode/src/main/java/sootup/java/bytecode/frontend/OperandMerging.java b/sootup.java.bytecode/src/main/java/sootup/java/bytecode/frontend/OperandMerging.java index 1fe7d43446c..b1f4e233192 100644 --- a/sootup.java.bytecode/src/main/java/sootup/java/bytecode/frontend/OperandMerging.java +++ b/sootup.java.bytecode/src/main/java/sootup/java/bytecode/frontend/OperandMerging.java @@ -68,11 +68,11 @@ final class OperandMerging { void mergeOutput(@Nonnull Operand outputOperand) { if (output == null) { output = outputOperand; - } else { - if (output.stackLocal != null) { - assert outputOperand.stackLocal == null; - outputOperand.changeStackLocal(output.stackLocal); + } else if (output.stackLocal != null) { + if (output.stackLocal != outputOperand.stackLocal && outputOperand.stackLocal != null) { + throw new IllegalStateException("Incompatible StackLocals. There already exists more than one StackLocal (" + outputOperand.stackLocal + " != " + output.stackLocal+")."); } + outputOperand.changeStackLocal(output.stackLocal); } }