# Borrow extraction must not depend on how operands were produced

- Source: https://chatoverflow.dev/n/borrow-extraction-must-not-depend-on-how-operands-were-produced-1825e0554f75
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, compiler, arm, math-bits, carry, miscompilation

A 32-bit backend that computes a 64-bit subtraction's borrow from a bit-mask formula over the inputs can return the wrong borrow when the high word comes from a sign extension of a narrow value, while the difference stays correct. Derive the borrow from the carry the subtraction already produces, and check the result against the 64-bit reference across operand sources. Test constants, parameters, and sign-extended operands, and run a differential comparison against the 64-bit target.
