## MLton 20241230

# Bugs20051202

Here are the known bugs in MLton 20051202, listed in reverse chronological order of date reported.

- Bug in the `Real<N>.fmt`, `Real<N>.fromString`, `Real<N>.scan`, and `Real<N>.toString` functions of the Basis Library implementation. These functions were using `TO_NEAREST` semantics, but should obey the current rounding mode. (Only `Real<N>.fmt StringCvt.EXACT`, `Real<N>.fromDecimal`, and `Real<N>.toDecimal` are specified to override the current rounding mode with `TO_NEAREST` semantics.)

  Thanks to Sean McLaughlin for the bug report.

  Fixed by revision `r5827`.

- Bug in the treatment of floating-point operations. Floating-point operations depend on the current rounding mode, but were being treated as pure.

  Thanks to Sean McLaughlin for the bug report.

  Fixed by revision `r5794`.

- Bug in the `Real32.toInt` function of the Basis Library implementation could lead incorrect results when applied to a `Real32.real` value numerically close to `valOf(Int.maxInt)`.

  Fixed by revision `r5764`.

- The `Socket` structure of the Basis Library implementation used `andb` rather than `orb` to unmarshal socket options (for `Socket.Ctl.get<OPT>` functions).

  Thanks to Anders Petersson for the bug report and patch.

  Fixed by revision `r5735`.

- Bug in the `Date` structure of the Basis Library implementation yielded some functions that would erroneously raise `Date` when applied to a year before 1900.

  Thanks to Joe Hurd for the bug report.

  Fixed by revision `r5732`.

- Bug in monomorphisation pass could exhibit the error `Type error: type mismatch`.

  Thanks to Vesa Karvonen for the bug report.

  Fixed by revision `r5731`.

- The `PackReal<N>.toBytes` function in the Basis Library implementation incorrectly shared (and mutated) the result vector.

  Thanks to Eric McCorkle for the bug report and patch.

  Fixed by revision `r5281`.

- Bug in elaboration of FFI forms. Using a unary FFI types (e.g., `array`, `ref`, `vector`) in places where `MLton.Pointer.t` was required would lead to an internal error `TypeError`.

  Fixed by revision `r4890`.

- The `MONO_VECTOR` signature of the Basis Library implementation incorrectly omits the specification of `find`.

  Fixed by revision `r4707`.

- The optimizer reports an internal error (`TypeError`) when an imported C function is called but not used.

  Thanks to "jq" for the bug report.

  Fixed by revision `r4690`.

- Bug in pass to flatten data structures.

  Thanks to Joe Hurd for the bug report.

  Fixed by revision `r4662`.

- The native codegen’s implementation of the C-calling convention failed to widen 16-bit arguments to 32-bits.

  Fixed by revision `r4631`.

- The `PACK_REAL` structures of the Basis Library implementation used byte, rather than element, indexing.

  Fixed by revision `r4411`.

- `MLton.share` could cause a segmentation fault.

  Fixed by revision `r4400`.

- The SSA simplifier could eliminate an irredundant test.

  Fixed by revision `r4370`.

- A program with a very large number of functors could exhibit the error `ElaborateEnv.functorClosure: firstTycons`.

  Fixed by revision `r4344`.