Skip to content

[Patch] Fix for fpc_val_smallint_shortstr

This is a follow up to #39406 (closed).

Previous patches supplied by me only covered 64-bit and 32-bit CPU. I now also examined the signed val-helpers for 16-bit and 8-bit CPU's.
I cannot test on an actual 8 or 16 bit computer (or VM).
The original code of fpc_val_smallint_shortstr (isolated and tested on 32-bit) produces 10998 errors when tested with valid input in the range '-65536' .. '65536'. It fails only for negative input, i.e. it fails for '-10' (Code=3), but succeeds for '-11' (which is a bit odd).

Attached is a patch that fixes fpc_val_smallint_shortstr. It uses a similar approach as for the 32- and 64-bit signed val-helpers.
The patched code runs as expected.

The fpc_val_longint_shortstr() helper seems to be OK. (But that should be verified with actual 8- or 16-bit code.)

fpc_val_smallint_shortstr.diff

Edited by Bart
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information