From 24faaef8f078134b929f16022f178ea23f46d109 Mon Sep 17 00:00:00 2001 From: rihi <19492038+rihi@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:28:34 +0200 Subject: [PATCH] Relaxe checks in collapse_nested_constants.py to allow more simplifications --- .../rules/collapse_nested_constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/decompiler/pipeline/controlflowanalysis/expression_simplification/rules/collapse_nested_constants.py b/decompiler/pipeline/controlflowanalysis/expression_simplification/rules/collapse_nested_constants.py index 62426e6dd..3a9214020 100644 --- a/decompiler/pipeline/controlflowanalysis/expression_simplification/rules/collapse_nested_constants.py +++ b/decompiler/pipeline/controlflowanalysis/expression_simplification/rules/collapse_nested_constants.py @@ -61,14 +61,14 @@ def _collect_constants(operation: Operation) -> Iterator[Constant]: current_operation = context_stack.pop() for i, operand in enumerate(current_operation.operands): - if operand.type != operand_type: # This check could potentially be relaxed to only check for equal size + if operand.type.size != operand_type.size: continue if isinstance(operand, Operation): if operand.operation == operation_type: context_stack.append(operand) continue - elif isinstance(operand, Constant) and _identity_constant(operation_type, operand_type).value != operand.value: + elif isinstance(operand, Constant) and isinstance(operand.value, int) and _identity_constant(operation_type, operand_type).value != operand.value: yield operand