Skip to content

DEC (HL) / (IX+d) dereferences the destination twice #14

Description

@xusheng6

The non-register branch of OP.DEC in Z80IL.py reuses the loaded value as the store address:

mem = operand_to_il(oper_type, oper_val, il, 1)   # this is a load
tmp = il.sub(1, mem, il.const(1, 1), flags="not_c")
tmp = il.store(1, mem, tmp)                        # ...used as an address

35 (DEC (HL)) lifts as [[HL].b].b = sub.b{not_c}([HL].b, 1) — it stores to the address formed by the loaded byte.

OP.INC handles the same operand correctly with peel_load=True; DEC should match. 19 sites in one test binary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions