From 5e60e459929ff9e149f256490ab40c0424143efd Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 5 Jul 2022 14:02:29 +0100 Subject: [PATCH] take deepcopy of regs passed in to avoid accidental modification --- src/openpower/test/state.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/openpower/test/state.py b/src/openpower/test/state.py index ee884f81..f8eae648 100644 --- a/src/openpower/test/state.py +++ b/src/openpower/test/state.py @@ -27,6 +27,7 @@ from openpower.decoder.isa.radixmmu import RADIX from openpower.util import log import os import sys +from copy import deepcopy global staterunner_factory staterunner_factory = {} @@ -242,13 +243,13 @@ class ExpectedState(State): int_regs = 32 if isinstance(int_regs, int): int_regs = [0] * int_regs - self.intregs = int_regs + self.intregs = deepcopy(int_regs) self.pc = pc if crregs is None: crregs = 8 if isinstance(crregs, int): crregs = [0] * crregs - self.crregs = crregs + self.crregs = deepcopy(crregs) self.so = so self.ov = ov self.ca = ca -- 2.30.2