Files
BFM-decomp/cookbook/C0423.md
T

609 B

§382 — TWO FOLD REASSOCIATIONS THAT NEED THEIR OWN STATEMENT (P31 S69)

gcc-2.7.2's fold rewrites these before you ever see RTL, so the fix is always "split the expression", never "add a cast":

  • A * (X / 0x7F * 0x3FFF) folds to (A * 0x3FFF) * X — the 0x3FFF scaling needs its own statement (func_80040DE8).
  • A + (B + C) reassociates to (A + C) + B — an address split into two statements blocks it (func_80021284).
  • (x << 9) | CONST | var reassociates so that only the shift gets hoisted — the four getTPage bases must be explicit pre-loop variables (func_8001EFE0).