Opened 2 years ago
Last modified 12 months ago
#334 closed defect
call.pl1 calculation for storage used by decimal(N) unaligned numbers is incorrect. — at Initial Version
| Reported by: | Gary Dixon | Owned by: | Eric Swenson |
|---|---|---|---|
| Priority: | major | Milestone: | MR12.9 |
| Component: | Tools | Version: | MR12.8 |
| Keywords: | Cc: |
Description
The Multics data types involving 4-bit decimal digits are selected by the PL/I Attributes:
- real fixed decimal (N) unaligned: which selects data type 43: real_fix_dec_4bit_bytealigned_ls_dtype
- real float decimal (N) unaligned: which selects data type 44: real_flt_dec_4bit_bytealigned_dtype
The calculation for storage used by this data type are made in the storage_for_pl1_dtype subroutine whose code resides in the call_dtype_fcns.incl.pl1 include segment. The existing calculations do not account for the requirement that stored scalar or array values of these data types must begin on a word boundary and occupy a full number of words. This is specified in the Multics Programmer's Reference Guide (AG91-04) Appendix D (page D-18), and was verified by array data descriptors created by the PL/I compiler for offset between adjacent array elements.
The proposed bug fix is shown by the following compare_ascii output.
cpa [lpn call_dtype_fcns.ip] == Inserted in B: B10 3) change(2024-02-16,GDixon): B11 Correct total words used to store fixed dec(N) unal and float dec(N) unal descriptor types: B12 real_fix_dec_4bit_bytealigned_ls_dtype, and real_flt_dec_4bit_bytealigned_dtype. These always B13 begin on word-boundary and always occupy a full number of words of storage even though they are B14 PL/I unaligned storage. The unaligned attribute shifts from 9-bit to 4-bit digits. Preceding: A10 END HISTORY COMMENTS */ A209 unalStoreSize (real_fix_dec_4bit_bytealigned_ls_dtype): /* +2 for sign nibble + round up to full byte boundary. */ A210 call st(BOUNDARY.Byte, divide(dsize+2, packed_digits_per_character,24,0)); A211 unalStoreSize (real_flt_dec_4bit_bytealigned_dtype): /* +2 for sign nibble + round up to full byte boundary. */ A212 /* +1 after divide for the binary exponent field. */ A213 call st(BOUNDARY.Byte, divide(dsize+2, packed_digits_per_character,24,0)+1); Changed by B to: B214 unalStoreSize (real_fix_dec_4bit_bytealigned_ls_dtype): /* +1 for sign nibble + round up to full word boundary. */ B215 call st(BOUNDARY.Word, B216 divide( dsize + 1 + (packed_digits_per_character * characters_per_word) - 1, B217 (packed_digits_per_character * characters_per_word), B218 24, 0)); B219 unalStoreSize (real_flt_dec_4bit_bytealigned_dtype): /* +1 for sign nibble +2 for the binary exponent field */ B220 /* rounded up to full word boundary */ B221 call st(BOUNDARY.Byte, B222 divide( dsize + 3 + (packed_digits_per_character * characters_per_word) - 1, B223 (packed_digits_per_character * characters_per_word), B224 24, 0));
