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 b1f4e233192..4882ddc17b0 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 @@ -69,10 +69,18 @@ void mergeOutput(@Nonnull Operand outputOperand) { if (output == null) { output = outputOperand; } 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+")."); + if (outputOperand.stackLocal == null) { + outputOperand.changeStackLocal(output.stackLocal); + } else { + if (output.stackLocal != outputOperand.stackLocal) { + throw new IllegalStateException( + "Incompatible stacklocal mismatch. There exist multiple, different possible output Locals (" + + outputOperand.stackLocal + + ", " + + output.stackLocal + + ")."); + } } - outputOperand.changeStackLocal(output.stackLocal); } }