From d5917112f90f242d59241a83da64ce35aef83e3f Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sun, 30 Apr 2023 21:50:19 +0300 Subject: [PATCH] power_insn: forbid zero for non-zero operands --- src/openpower/decoder/power_insn.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index 486d1d65..b9d92508 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -1148,6 +1148,8 @@ class NonZeroOperand(DynamicOperand): value = int(value, 0) if not isinstance(value, int): raise ValueError("non-integer operand") + if value == 0: + raise ValueError("non-zero operand") value -= 1 return super().assemble(value=value, insn=insn) -- 2.30.2