Release of OCaml 5.5.1
We have the pleasure of celebrating the birthday of Giovanni Girolamo Saccheri by announcing the release of OCaml version 5.5.1.
This patch-level release fixes a major type system bug for module-dependent functions and also contains two security fixes for the runtime: one in the Marshal module, another inside the loading of bytecode.
At a less severe level, this release also fixes two bugs in the runtime for concurrent programs, another runtime bug for musl users; and a handful of other bugs.
The release also restores support for cloning the compiler on macOS.
Overall, we are strongly advising you to switch to OCaml 5.5.1 if you were already using OCaml 5.5.0.
The full list of changes can be found in the full changelog.
Installation Instructions
The base compiler can be installed as an opam switch with the following commands:
opam update
opam switch create 5.5.1
The source code for the release is also directly available on:
Fine-Tuned Compiler Configuration
If you want to tweak the configuration of the compiler, you can switch to the option variant with:
opam update
opam switch create <switch_name> ocaml-variants.5.5.1+options <option_list>
where <option_list> is a space separated list of ocaml-option-* packages.
For instance, for a flambda and no-flat-float-array switch:
opam switch create 5.5.1+flambda+nffa ocaml-variants.5.5.1+options ocaml-option-flambda ocaml-option-no-flat-float-array
See full changelog
Bug fixes
Type system
- 14891,
14982: fix scope error
leading to an erroneous typechecking for non-dependent application of
module-dependent function in presence of dependent first-class module
types:
(Florian Angeletti, report by Hazem ElMasry, review by Gabriel Scherer)module type T = sig module type S end let f (module M:T) (m: (module M.S)) = m module type P = sig type 'a t end let error = f (module struct module type S = P end) (module List)
Runtime
-
14872: harden loading of bytecode executable files against corrupted or malicious files having 2^29 TOC entries or more. (Xavier Leroy, review by Nicolás Ojeda Bär)
-
15019, 15030, OSEC-2026-18:
Marshal.from_{string,bytes}: guard against overflow in the computation of the total data length. (Xavier Leroy, report by Akshay Singh, review by Nicolás Ojeda Bär and Antonin Décimo) -
14933: Respect
sysconf(_SC_SIGSTKSZ)when choosing the size for the alternate signal stack, avoiding fatal errors when linked against musl libc on some Intel CPUs. (Nat Mote, review by Florian Angeletti and Miod Vallat) -
14940, fix a memory leak in the OCaml runtime by bounding the size of the internal cache of stacks. (Vesa Karvonen, Florian Angeletti, review by Gabriel Scherer)
-
15029: Fix a regression on Windows where an OCaml thread that never yielded voluntarily would keep the runtime lock forever, so that the other threads of its domain never ran. Preemptive switching between systhreads had no effect; only explicit calls to
Thread.yieldor blocking sections would let other threads run. (Nicolás Ojeda Bär, report by Daniel Larraz, review by Antonin Décimo)
Build system
-
14883, 14884: fix Windows cross-compilation with older mingw32-gcc versions (Brian Ward, review by Antonin Décimo and Stefan Muenzel)
-
14871, 14914: Ignore OCAMLTOP_INCLUDE_PATH during the build. (David Allsopp, report by Andreas Rossberg, review by Florian Angeletti)
-
14901, 14923: Fix the generated installation script to cope with macOS's geriatric version of bash when executing in opam's sandbox. (David Allsopp, report by Julian Fondren and Sacha-Élie Ayoun, investigation and initial fix by Kate Deplaix, review by Florian Angeletti)
-
14989: Improve build reproducibility by letting only otherlibs/{str,unix} build their own .cmi and .cmx. The generic %.cmi/%.cmx rules of the root Makefile were racing with them under make -j and recorded a different source path, which changed the interface digest (and, through it, most other compiled artefacts) as well as the debug info packed into str.a and unix.a. (Bernhard M. Wiedemann, review by David Allsopp and Stefan Muenzel)
User interface
- 14881, 14882: fix printing of external types that are subject to module constraints. (Stefan Muenzel, review by Florian Angeletti)
Runtime events library
-
14966: add the missing EV_MINOR_EPHE_CLEAN constructor to Runtime_events.runtime_phase, introduced in 13643. The runtime has emitted this phase since 5.4, when a minor collection has to clean locked ephemerons, but the OCaml type had no constructor for it, so consumers were handed an out-of-range value and crashed when matching on it. (Tim McGilchrist, review by Florian Angeletti)
-
14969: Fix the units of the runtime events counter EV_C_MINOR_ALLOCATED_WORDS to report as the number of words of minor heap consumed, including headers. (Tim McGilchrist, review by Nicolás Ojeda Bär)