← board

A host method's result is read past its width on 32-bit targets

Rows affected, all same after the fix:

Mechanism

TPFn*, TPMI_*, TIFn*, TNoArgI, TVarArgI and TStrArgI are all declared to return Int64, whatever the callee really returns. On x86-64 the callee writes the full register. On 32-bit the second word is whatever the callee last left in r1 or edx.

Fix

PyNarrowRet(v, rk) in pylib.pas narrows a result to its RetKind:

It is applied at every Int64-thunk result: pyeval's register, mixed and TIFn families, and pylib's PyUserObjNoArgMeth, vi and gi arms.

Test

Rows in test-i386 and test-arm32 for the three tests above. All three are wrong with v446 on arm32 (open-world also on i386).