diff --git a/src/de/wwu/muggl/instructions/general/Load.java b/src/de/wwu/muggl/instructions/general/Load.java index 4f3e85ad..519b7d32 100644 --- a/src/de/wwu/muggl/instructions/general/Load.java +++ b/src/de/wwu/muggl/instructions/general/Load.java @@ -17,6 +17,7 @@ import de.wwu.muggl.vm.execution.MugglToJavaConversion; import de.wwu.muggl.vm.impl.symbolic.SymbolicExecutionException; import de.wwu.muggl.vm.impl.symbolic.SymbolicVirtualMachine; +import de.wwu.muggl.vm.initialization.ModifieableArrayref; import de.wwu.testtool.expressions.Variable; /** @@ -178,7 +179,12 @@ public void executeSymbolically(Frame frame, int localVariable) throws NoExcepti // Generate an ArrayInitializationChoicePoint. ((SymbolicVirtualMachine) frame.getVm()).generateNewChoicePoint(this, null, null); - frame.getMethod().setGeneratedValue(localVariable, localVariables[localVariable]); + + if (localVariables[localVariable] == null) { + frame.getMethod().setGeneratedValue(localVariable, null); + } else { + frame.getMethod().setGeneratedValue(localVariable, ((ModifieableArrayref)localVariables[localVariable]).clone()); + } } else { // Create and push an non array type. Variable variable = this.typedInstruction.getNewVariable(frame.getMethod(), localVariable); diff --git a/src/de/wwu/muggl/symbolic/searchAlgorithms/choice/array/ArrayInitializationChoicePoint.java b/src/de/wwu/muggl/symbolic/searchAlgorithms/choice/array/ArrayInitializationChoicePoint.java index 8ecd4376..6fa379d1 100644 --- a/src/de/wwu/muggl/symbolic/searchAlgorithms/choice/array/ArrayInitializationChoicePoint.java +++ b/src/de/wwu/muggl/symbolic/searchAlgorithms/choice/array/ArrayInitializationChoicePoint.java @@ -509,7 +509,11 @@ public synchronized void applyStateChanges() { // Set or push? if (this.index != -1) { this.frame.setLocalVariable(this.index, this.preparedArray); - this.frame.getMethod().setGeneratedValue(this.index, this.preparedArray); + if (this.preparedArray == null) { + this.frame.getMethod().setGeneratedValue(this.index, null); + } else { + this.frame.getMethod().setGeneratedValue(this.index, this.preparedArray.clone()); + } } else { // Push. this.frame.getOperandStack().push(this.preparedArray);