OCaml Changelog

RSS

Read the latest releases and updates from the OCaml ecosystem.

One month after the release of the first beta for OCaml 5.3.0, we are releasing a second and hopefully last beta release for OCaml 5.3.0 .

The most notable changes for this second beta are probably a handful of type system bugfixes. In particular, those fixes revert a change of behaviour in the first beta when pattern matching GADTs with non-injective type parameters.

We also have a C++ header compatibility fix and the restoration of some configuration variable in Makefiles for the sake of backward compatibility.

Overall, the release is converging and we are expecting to have a first release candidate around the middle of December. The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.3.0 meta-issue.

Meanwhile, the second beta release of OCaml 5.3.0 is here to help you update your software and libraries ahead of the release (see below for the installation instructions).

The full release is expected before the end of December.

If you find any bugs, please report them on OCaml's issue tracker.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.3.0 is available on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later:

opam update
opam switch create 5.3.0~beta2

The source code for the beta is also available at these addresses:

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.3.0~beta2+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.3.0~beta2+flambda+nffa ocaml-variants.5.3.0~beta2+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Changes Since The First Beta

Type system fixes

  • #13501: Regression on mutually recursive types caused by #12180. Resuscitate Typedecl.update_type. (Jacques Garrigue and Takafumi Saikawa, review by Florian Angeletti, Richard Eisenberg and Gabriel Scherer)

  • #13495, #13514: Fix typechecker crash while typing objects (Jacques Garrigue, report by Nicolás Ojeda Bär, review by Nicolas Ojeda Bär, Gabriel Scherer, Stephen Dolan, Florian Angeletti)

  • #13598: Falsely triggered warning 56 [unreachable-case] This was caused by unproper protection of the retyping function. (Jacques Garrigue, report by Tõivo Leedjärv, review by Florian Angeletti)

Configuration fixes

  • (breaking change) #12578, #12589, #13322, +#13519: Use configured CFLAGS and CPPFLAGS only during the build of the compiler itself. Do not use them when compiling third-party C sources through the compiler. Flags for compiling third-party C sources can still be specified at configure time in the COMPILER_{BYTECODE,NATIVE}_{CFLAGS,CPPFLAGS} configuration variables. (Sébastien Hinderer, report by William Hu, review by David Allsopp)

C++ header compatibility

  • #13541, #13591: Fix headers for C++ inclusion. (Antonin Décimo, review by Nick Barnes, report by Kate Deplaix)

Compiler library bug fix

  • #13603, #13604: fix source printing in the presence of the escaped raw identifier \#mod. (Florian Angeletti, report by Chris Casinghino, review by Gabriel Scherer)

We have the pleasure of announcing the release of OCaml 5.2.1, dedicated to the memory of Niels Bohr and Paul Éluard on the anniversary of their deaths.

OCaml 5.2.1 is a collection of safe but import runtime time bug fixes backported from the 5.3 branch of OCaml.

The full list of changes is available above for more details.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands:

opam update
opam switch create 5.2.1

The source code for the release is also directly available on:

See full changelog

Changes Since OCaml 5.2.0

Runtime System:

  • #13207: Be sure to reload the register caching the exception handler in caml_c_call and caml_c_call_stack_args, as its value may have been changed if the OCaml stack is expanded during a callback. (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and Xavier Leroy)

  • #13252: Rework register assignment in the interpreter code on m68k on Linux, due to the %a5 register being used by GLIBC. (Miod Vallat, report by Stéphane Glondu, review by Gabriel Scherer and Xavier Leroy)

  • #13268: Fix a call to test in configure.ac that was causing errors when LDFLAGS contains several words. (Stéphane Glondu, review by Miod Vallat)

  • #13234, #13267: Open runtime events file in read-write mode on ARMel (ARMv5) systems due to atomic operations limitations on that platform. (Stéphane Glondu, review by Miod Vallat and Vincent Laviron)

  • #13188: fix races in the FFI code coming from the use of Int_val(...) on rooted values inside blocking questions / without the runtime lock. (Calling Int_val(...) on non-rooted immediates is fine, but any access to rooted values must be done outside blocking sections / with the runtime lock.) (Etienne Millon, review by Gabriel Scherer, Jan Midtgaard, Olivier Nicole)

  • #13318: Fix regression in GC alarms, and fix them for Flambda. (Guillaume Munch-Maccagnoni, report by Benjamin Monate, review by Vincent Laviron and Gabriel Scherer)

  • #13140: POWER back-end: fix issue with call to caml_call_realloc_stack from a DLL (Xavier Leroy, review by Miod Vallat)

  • #13370: Fix a low-probability crash when calling Gc.counters. (Demi Marie Obenour, review by Gabriel Scherer)

  • #13402, #13512, #13549, #13553: Revise bytecode implementation of callbacks so that it no longer produces dangling registered bytecode fragments. (Xavier Leroy, report by Jan Midtgaard, analysis by Stephen Dolan, review by Miod Vallat)

  • #13502: Fix misindexing related to Gc.finalise_last that could prevent finalisers from being run. (Nick Roberts, review by Mark Shinwell)

  • #13520: Fix compilation of native-code version of systhreads. Bytecode fields were being included in the thread descriptors. (David Allsopp, review by Sébastien Hinderer and Miod Vallat)

The release of OCaml version 5.2.1 is imminent.

OCaml 5.2.1 is a collection of safe but import runtime time bug fixes backported from the 5.3 branch of OCaml. The full list of bug fixes is available above.

In order to ensure that the future release works as expected, we are planning to test a release candidate during the upcoming week.

If you find any bugs, please report them here on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 5.2.1~rc1

The source code for the release candidate is 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.2.1~rc1+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.2.1~rc1+flambda+nffa ocaml-variants.5.2.1~rc1+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Changes Since OCaml 5.2.0

Runtime System:

  • #13207: Be sure to reload the register caching the exception handler in caml_c_call and caml_c_call_stack_args, as its value may have been changed if the OCaml stack is expanded during a callback. (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and Xavier Leroy)

  • #13252: Rework register assignment in the interpreter code on m68k on Linux, due to the %a5 register being used by GLIBC. (Miod Vallat, report by Stéphane Glondu, review by Gabriel Scherer and Xavier Leroy)

  • #13268: Fix a call to test in configure.ac that was causing errors when LDFLAGS contains several words. (Stéphane Glondu, review by Miod Vallat)

  • #13234, #13267: Open runtime events file in read-write mode on ARMel (ARMv5) systems due to atomic operations limitations on that platform. (Stéphane Glondu, review by Miod Vallat and Vincent Laviron)

  • #13188: fix races in the FFI code coming from the use of Int_val(...) on rooted values inside blocking questions / without the runtime lock. (Calling Int_val(...) on non-rooted immediates is fine, but any access to rooted values must be done outside blocking sections / with the runtime lock.) (Etienne Millon, review by Gabriel Scherer, Jan Midtgaard, Olivier Nicole)

  • #13318: Fix regression in GC alarms, and fix them for Flambda. (Guillaume Munch-Maccagnoni, report by Benjamin Monate, review by Vincent Laviron and Gabriel Scherer)

  • #13140: POWER back-end: fix issue with call to caml_call_realloc_stack from a DLL (Xavier Leroy, review by Miod Vallat)

  • #13370: Fix a low-probability crash when calling Gc.counters. (Demi Marie Obenour, review by Gabriel Scherer)

  • #13402, #13512, #13549, #13553: Revise bytecode implementation of callbacks so that it no longer produces dangling registered bytecode fragments. (Xavier Leroy, report by Jan Midtgaard, analysis by Stephen Dolan, review by Miod Vallat)

  • #13502: Fix misindexing related to Gc.finalise_last that could prevent finalisers from being run. (Nick Roberts, review by Mark Shinwell)

  • #13520: Fix compilation of native-code version of systhreads. Bytecode fields were being included in the thread descriptors. (David Allsopp, review by Sébastien Hinderer and Miod Vallat)

One month and half after the release of the first alpha for OCaml 5.3.0, the release of OCaml 5.3.0 is drawing near.

The internal API of the compiler libraries has been frozen, and most core developer tools support (or will support soon) the new version of the compiler.

We have thus released a first beta version of OCaml 5.3.0 to help you update your software and libraries ahead of the release (see below for the installation instructions). More information about the whole release process is now available in the compiler repository.

Compared to the first alpha release, this beta contains a few runtime or typechecker fixes, a handful of fixes for the runtime event library and other miscellaneous fixes.

Exceptionally, this beta release also introduces a new flag -keywords for the compiler. This backward compatibility flag aims to help compiling old code that are using effect as a normal identifier, now that effect is a keyword in the new effect handler syntax.

The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.3.0 meta-issue.

The full release is expected in the end of November or beginning of December, see the new prospective calendar for more information.

If you find any bugs, please report them on OCaml's issue tracker.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.3.0 is available on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later:

opam update
opam switch create 5.3.0~beta1

The source code for the beta is also available at these addresses:

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.3.0~beta1+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.3.0~beta1+flambda+nffa ocaml-variants.5.3.0~beta1+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Runtime fixes

  • #13502: Fix misindexing related to Gc.finalise_last that could prevent finalisers from being run. (Nick Roberts, review by Mark Shinwell)

  • #13402, #13512, #13549, #13553: Revise bytecode implementation of callbacks so that it no longer produces dangling registered bytecode fragments. (Xavier Leroy, report by Jan Midtgaard, analysis by Stephen Dolan, review by Miod Vallat)

  • #13520: Fix compilation of native-code version of systhreads. Bytecode fields were being included in the thread descriptors. (David Allsopp, review by Sébastien Hinderer and Miod Vallat)

Typechecker fixes

  • #13579, #13583: Unsoundness involving non-injective types + gadts (Jacques Garrigue, report by @v-gb, review by Richard Eisenberg and Florian Angeletti)

  • #13388, #13540: raises an error message (and not an internal compiler error) when two local substitutions are incompatible (for instance module type S:=sig end type t:=(module S)) (Florian Angeletti, report by Nailen Matschke, review by Gabriel Scherer, and Leo White)

Compiler flag

  • #13471: add -keywords <version?+list> flag to define the list of keywords recognized by the lexer, for instance -keywords 5.2 disable the effect keyword. (Florian Angeletti, review by Gabriel Scherer)

Runtime event library fixes

  • #13419: Fix memory bugs in runtime events system. (B. Szilvasy and Nick Barnes, review by Miod Vallat, Nick Barnes, Tim McGilchrist, and Gabriel Scherer)

  • #13407: Add Runtime_events.EV_EMPTY_MINOR (Thomas Leonard)

  • #13522: Confirm runtime events ring is still active after callback. (KC Sivaramakrishnan, review by Sadiq Jaffer and Miod Vallat)

  • #13529: Do not write to event ring after going out of stw participant set. (KC Sivaramakrishnan, review by Sadiq Jaffer)

Documentation

  • #13424: Fix Gc.quick_stat documentation to clarify that returned fields live_words, live_blocks, free_words, and fragments are not zero. (Jan Midtgaard, review by Damien Doligez and KC Sivaramakrishnan)

  • #13440: Update documentation of Gc.{control,get,set} to reflect fields not currently supported on OCaml 5. (Jan Midtgaard, review by Gabriel Scherer)

  • #13469, #13474, #13535: Document that [Hashtbl.create n] creates a hash table with a default minimal size, even if [n] is very small or negative. (Antonin Décimo, Nick Bares, report by Nikolaus Huber and Jan Midtgaard, review by Florian Angeletti, Anil Madhavapeddy, Gabriel Scherer, and Miod Vallat)

Standard library internal fix

  • #13543: Remove some String-Bytes conversion from the stdlib to behave better with js_of_ocaml (Hugo Heuzard, review by Gabriel Scherer)

Toplevel fix

  • #13263, #13560: fix printing true and false in toplevel and error messages (no more unexpected #true) (Florian Angeletti, report by Samuel Vivien, review by Gabriel Scherer)

Compiler internals

  • #13391, #13551: fix a printing bug with -dsource when using raw literal inside a locally abstract type constraint (i.e. let f: type \#for. ... ) (Florian Angeletti, report by Nick Roberts, review by Richard Eisenberg)

Four months after the release of OCaml 5.2.0, the set of new features for the future version 5.3.0 of OCaml has been frozen. We are thus happy to announce the first alpha release for OCaml 5.3.0.

This alpha version is here to help fellow hackers join us early in our bug hunting and opam ecosystem fixing fun (see below for the installation instructions). More information about the whole release process is now available in the compiler repository, and we will try to propagate this information to ocaml.org shortly.

The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.3.0 meta-issue.

The full release is expected around November, see the new prospective calendar for more information.

If you find any bugs, please report them on OCaml's issue tracker.

If you are interested in the ongoing list of new features and bug fixes, the updated change log for OCaml 5.3.0 is available on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later:

opam update
opam switch create 5.3.0~alpha1

The source code for the alpha is also available at these addresses:

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.3.0~alpha1+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.3.0~alpha1+flambda+nffa ocaml-variants.5.3.0~alpha1+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

We have the pleasure of celebrating Inge Lehmann's birthday by announcing the release of OCaml version 5.2.0.

Some of the highlights in OCaml 5.2.0 are:

  • Reintroduced GC compaction
  • Restored native backend for POWER 64 bits
  • Thread sanitiser support
  • New Dynarray module
  • New -H flag for hidden include directories
  • Project-wide occurence metadata support for developer tools
  • Raw identifiers
  • Local open in type expressions

And a lot of incremental changes:

  • Around 20 new functions in the standard library
  • Many fixes and improvements in the runtime
  • Many bug fixes

OCaml 5.2.0 is still a somewhat experimental release compared to the OCaml 4.14 branch. In particular:

  • The Windows MSVC port is still unavailable.
  • Ephemeron performances need to be investigated.
  • statmemprof is being tested in the developer branch.
  • There are a number of known runtime concurrency or GC performance bugs (that trigger under rare circumstances).

Since the Windows MSVC port and statmemprof are still missing, the maintenance support for OCaml 4.14 will be extended until at least the end of the year.

Please report any unexpected behaviours on the OCaml issue tracker and post any questions or comments you might have on our discussion forums.

The full list of changes can be found in the changelog below.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands:

opam update
opam switch create 5.2.0

The source code for the release candidate 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.2.0+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.2.0+flambda+nffa ocaml-variants.5.0.0+options ocaml-option-flambda ocaml-option-no-flat-float-array
See full changelog

(Changes that can break existing programs are marked with a "*")

Restored and New Backends:

  • #12276, #12601: Native-code compilation for POWER (64 bits, little-endian) (Xavier Leroy, review by KC Sivaramakrishnan, Anil Madhavapeddy, and Stephen Dolan)

  • #12667: Extend the latter to POWER 64 bits, big-endian, ELFv2 ABI (A. Wilcox, review by Xavier Leroy)

Runtime System:

  • #12193: Reintroduce GC compaction for shared pools. Adds a parallel compactor for the shared pools (which contain major heap blocks sized less than 128 words). Explicit only for now, on calls to Gc.compact. (Sadiq Jaffer, Nick Barnes, review by Anil Madhavapeddy, Damien Doligez, David Allsopp, Miod Vallat, Artem Pianykh, Stephen Dolan, Mark Shinwell, and KC Sivaramakrishnan)

  • #12114: Add ThreadSanitizer support (Fabrice Buoro and Olivier Nicole, based on an initial work by Anmol Sahoo, review by Damien Doligez, Sébastien Hinderer, Jacques-Henri Jourdan, Luc Maranget, Guillaume Munch-Maccagnoni, Gabriel Scherer)

  • #12850: Update Gc.quick_stat data at the end of major cycles and compaction. This PR adds an additional caml_collect_gc_stats_sample_stw to the major heap cycling STW. This means that Gc.quick_stat now actually reflects the state of the heap after a major cycle or compaction. (Sadiq Jaffer, review by Miod Vallat and Gabriel Scherer)

  • #12859: Ensure Gc.compact does a full major before the compactor runs (Sadiq Jaffer, review by Leo White, Mark Shinwell, Gabriel Scherer, Josh Berdine, David Allsopp, and KC Sivaramakrishnan)

  • #10111: Increase the detail of location information for debugging events to allow the end-line number and character offset to be reported. (David Allsopp, review by Nick Barnes, Enguerrand Decorne and Stephen Dolan)

  • #10403, #12202: Introduce caml_ext_table_add_noexc that does not raise Out_of_memory exceptions, and use it inside the blocking sections of caml_read_directory. Also, check for overflows in EXT table sizes. (Xavier Leroy, report by Arseniy Alekseyev, review by Gabriel Scherer)

  • #11332, #12702: Make sure Bool_val(v) has type bool in C++ (Xavier Leroy, report by ygrek, review by Gabriel Scherer)

  • #12772, #12787: Avoid using _Bool in public headers for the sake of C++ compatibility (Guillaume Munch-Maccagnoni, report by KC Sivaramakrishnan, review by Xavier Leroy and KC Sivaramakrishnan)

  • #12223: Constify constructors and flags tables in C code. Now these tables will go in the read-only segment where they belong. (Antonin Décimo, review by Gabriel Scherer and Xavier Leroy)

  • #12234: Make instrumented time calculation more thread-safe on macOS. (Anil Madhavapeddy, review by Daniel Bünzli and Xavier Leroy)

  • #12235, #12468: Introduce and use the CAMLnoret macro as a lighter alternative to CAMLnoreturn_start / CAMLnoreturn_end. Implement it so as to conform with C11, C23, C++11, C++17. (Xavier Leroy and Dhruv Maroo, with help from Antonin Décimo, review by Gabriel Scherer and David Allsopp)

  • #12275: caml/stack.h: More abstract macros to describe OCaml stacks and how to traverse them, supporting more stack layouts. (Xavier Leroy, review by KC Sivaramakrishnan and Fabrice Buoro)

  • #12268: Deliver Out_of_memory exception if domain creation fails due to memory resource exhaustion. Previously, it was always a Failure. (Anil Madhavapeddy, review by David Allsopp)

  • #12300, #12314: Discard out_channel buffered data on permanent I/O error (Xavier Leroy, report by Török Edwin, review by Anil Madhavapeddy and Nicolás Ojeda Bär)

  • #11386: Simplifications and fixes to Multicore systhreads implementation. (Guillaume Munch-Maccagnoni, review by Anil Madhavapeddy and KC Sivaramakrishnan)

  • #12875, #12879, #12882: Execute preemptive systhread switching as a delayed pending action. This ensures that one can reason within the FFI that no mutation happens on the same domain when allocating on the OCaml heap from C, consistently with OCaml 4. This also fixes further bugs with the Multicore systhreads implementation. (Guillaume Munch-Maccagnoni, bug reports and suggestion by Mark Shinwell, review by Nick Barnes and Stephen Dolan)

  • #12408: Domain.spawn no longer leaks its functional argument for the whole duration of the children's domain lifetime. (Guillaume Munch-Maccagnoni, review by Gabriel Scherer)

  • #12409: Fix unsafety and deadlocks should an asynchronous exception arise at specific locations during domain creation and shutdown. (Guillaume Munch-Maccagnoni, review by Gabriel Scherer)

  • #11911, #12381: Restore statmemprof functionality in part, with some API changes in Gc.Memprof. (Nick Barnes, review by Jacques-Henri Jourdan and Guillaume Munch-Maccagnoni).

  • #12430: Simplify dynamic bytecode loading in Meta.reify_bytecode (Stephen Dolan, review by Sébastien Hinderer, Vincent Laviron and Xavier Leroy)

  • #12489: Fix an error-handling bug in caml_alloc_sprintf (Stephen Dolan, report by Chris Casinghino, review by Jeremy Yallop and Xavier Leroy)

  • #11307: Finish adapting the implementation of asynchronous actions for Multicore: soundness, liveness, and performance issues. Do not crash if a signal handler is called from an unregistered C thread and other possible soundness issues. Prevent issues where joins on other domains could make the toplevel unresponsive to Ctrl-C. Avoid needless repeated polling in C code when callbacks cannot run immediately. (Guillaume Munch-Maccagnoni, review by Enguerrand Decorne, Xavier Leroy, and KC Sivaramakrishnan)

  • #12634: Simplify TSan backtrace bookkeeping upon raise (Olivier Nicole and Fabrice Buoro, review by Gabriel Scherer)

  • (Breaking Change) #12686: Some primitives had the wrong types to be callable from the bytecode interpreter. Either fix their types, mark them as CAMLexport instead of CAMLprim, or remove them entirely if no longer used. (Xavier Leroy, review by David Allsopp)
  • #12700, continuing #11763 and trying to address #12660: Use the correct types for primitives when generating the table of primitives used by ocamlrun. (Xavier Leroy, motivation, review and improvements by Antonin Décimo)

  • #12345, #12710: Fix issues with finaliser orphaning at domain termination (KC Sivaramakrishnan, report by Gabriel Scherer, review by Gabriel Scherer, Sadiq Jaffer and Fabrice Buoro)

  • #12599: Refactor Dynlink startup to avoid parsing bytecode sections twice (Stephen Dolan, review by David Allsopp, Hugo Heuzard, Damien Doligez and Xavier Leroy)

  • #12678, #12898: Free channel buffers on close rather than on finalisation (Damien Doligez, review by Jan Midtgaard and Gabriel Scherer, report by Jan Midtgaard)

  • #12681: Fix TSan false positives due to volatile write handling (Olivier Nicole, Fabrice Buoro, and Anmol Sahoo, review by Luc Maranget, Gabriel Scherer, Hernan Ponce de Leon, and Xavier Leroy)

  • #12743: Use pthread_sigmask instead of sigprocmask. Updates usage of sigprocmask to pthread_sigmask in otherlibs/unix. (Max Slater, review by Miod Vallat and Xavier Leroy)

  • #12769: Unify MSVC and MinGW-w64 code paths, by always using WinAPI directly. (David Allsopp, Antonin Décimo, and Samuel Hym, review by Nicolas Ojeda Bar)

  • #11911, #12382, #12383: Restore statmemprof functionality in part (backtrace buffers, per-thread and per-domain data structures, GC/allocation interface). (Nick Barnes, review by Gabriel Scherer, Fabrice Buoro, Sadiq Jaffer, Guillaume Munch-Maccagnoni, and Jacques-Henri Jourdan).

  • #12735: Store both ends of the stack chain in continuations (Leo White, review by Miod Vallat and KC Sivaramakrishnan)

  • #12746: Simplify and clean up TSan annotations (Olivier Nicole, review by Miod Vallat and Fabrice Buoro)

  • #12809: Add ThreadSanitizer support to FreeBSD/AMD64 (Miod Vallat, review by Gabriel Scherer)

  • #12810: Port ThreadSanitizer support to Linux and macOS on arm64 (Miod Vallat, review by Tim McGilchrist)

  • #12811: Define and use the CAMLthread_local macro for TLS variables. (Antonin Décimo and Samuel Hym, review by Miod Vallat and Xavier Leroy)

  • #12814: More detailed failure messages from input_value and Marshal.from_* (Xavier Leroy, review by Stephen Dolan and Anil Madhavapeddy)

  • #12815: Correctly format multiline locations in exception backtraces in the compiler driver's style. (David Allsopp, review by Gabriel Scherer)

  • #12773, #12830, #12834: Rewrite caml_c_thread_(un)register to fix various bugs. (Guillaume Munch-Maccagnoni, reported by Miod Vallat, suggested by Hari Hara Naveen S, reviewed by Fabrice Buoro, Gabriel Scherer, and Miod Vallat)

  • #12876: Port ThreadSanitizer support to Linux on POWER (Miod Vallat, review by Tim McGilchrist)

  • #12886: Reinitialise I/O mutexes after fork (Max Slater, review by Guillaume Munch-Maccagnoni and Xavier Leroy)

  • #12907: Port ThreadSanitizer support to Linux on RiscV (Miod Vallat, review by Nicolás Ojeda Bär and Fabrice Buoro)

  • #12915: Port ThreadSanitizer support to Linux on s390x (Miod Vallat, review by Tim McGilchrist)

  • #12934: Fix data races between marking and sweeping functions (Olivier Nicole, suggested by Stephen Dolan, review by Gabriel Scherer, Miod Vallat, and Damien Doligez)

Language Features:

  • #12295, #12568: Give while true a polymorphic type, similarly to assert false (Jeremy Yallop, review by Nicolás Ojeda Bär and Gabriel Scherer, suggestion by Rodolphe Lepigre and John Whitington)

  • #12044: Add local module open syntax for types.

      module A = struct
        type t = int
        type r = unit
        type s = string
      end
    
      type example = A.(t * r * s)
    

    (Alistair O'Brien, review by Gabriel Scherer, Nicolás Ojeda Bär, and Florian Angeletti)

  • #11252, RFC 27: Support raw identifier syntax \#foo (Stephen Dolan, review by David Allsopp, Gabriel Scherer, and Olivier Nicole)

  • #12315: Use type annotations from arguments in let rec (Stephen Dolan, review by Gabriel Scherer)

  • #12375: Allow use of [@untagged] for all immediate types like char, bool, and variant with only constant constructors. (Christophe Raffalli, review by Gabriel Scherer)

  • (Breaking Change) #12502: The compiler now normalises the newline sequence \r\n to a single \n character during lexing to guarantee that the semantics of newlines in string literals are not modified by Windows tools transforming \n into \r\n in source files. Warning 29 [eol-in-string] is not emitted anymore, as the normalisation gives more robust semantics to newlines in string literals. (Gabriel Scherer and Damien Doligez, review by Daniel Bünzli, David Allsopp, Andreas Rossberg, Xavier Leroy, report by Andreas Rossberg)

Standard Library:

  • #11563: Add the Dynarray module to the stdlib. Dynamic arrays are arrays whose length can be changed by adding or removing elements at the end, similar to 'vectors' in C++ or Rust. (Gabriel Scherer, Simon Cruanes, and Florian Angeletti, review by Daniel Bünzli, Guillaume Munch-Maccagnoni, Clément Allain, Damien Doligez, Wiktor Kuchta, and Pieter Goetschalckx)

  • #12716: Add Format.pp_print_nothing function. (Léo Andrès, review by Gabriel Scherer and Nicolás Ojeda Bär)

  • (Breaking Change) #6732, #12423: Make Buffer.add_substitute surjective and fix its documentation. (Damien Doligez, review by Antonin Décimo)

  • (Breaking Change) #10775, #12499: Half-precision, floating-point elements in Bigarray. (Anton Yabchinskiy, review by Xavier Leroy and Nicolás Ojeda Bär)

  • #11517, #12477: Expose pp_infinity in interface of the format module and check that margin is less than pp_infinity when setting or checking geometry. (Janith Petangoda, reported by Simmo Saan, reviewed by Florian Angeletti, Simmo Saan, Josh Berdine, and Gabriel Scherer)

  • #12217: Add Array.shuffle. (Daniel Bünzli, review by Nicolás Ojeda Bär, David Allsopp, and Alain Frisch)

  • #12212: Add cache-aligned constructor for atomics. The patch ensures that all allocations (of the right size) in the shared heap are aligned. (Bartosz Modelski with Gabriel Scherer, Guillaume Munch-Maccagnoni, Xavier Leroy, review by Alain Frisch, Anil Madhavapeddy, Gabriel Scherer, Guillaume Munch-Maccagnoni, KC Sivaramakrishnan, Stefan Muenzel, Xavier Leroy)

  • #12307: Add BLAKE2b hashing and an MD5 submodule to the Digest module. (Xavier Leroy, review by Olivier Nicole, Gabriel Scherer, Wiktor Kuchta, Daniel Bünzli, David Allsopp)

  • #12365: Add In_channel.input_bigarray, In_channel.really_input_bigarray, Out_channel.output_bigarray, Unix.read_bigarray, Unix.write_bigarray, Unix.single_write_bigarray. (Nicolás Ojeda Bär, review by Jeremy Yallop, Xavier Leroy, Gabriel Scherer, David Allsopp)

  • #12455: Add Array.init_matrix, Float.Array.make_matrix, Float.Array.init_matrix. (Glen Mével, review by Xavier Leroy, Gabriel Scherer, Jeremy Yallop, Nicolas Ojeda Bar)

  • (Breaking Change) #12455: Array.make_matrix dimx dimy f now raises Invalid_argument when dimx = 0 && dimy < 0. This was already specified but not enforced. (Glen Mével, report by Jeremy Yallop, review by Nicolas Ojeda Bar)
  • #12459: Add Random.int_in_range, Random.int32_in_range, Random.int64_in_range, Random.nativeint_in_range, and their counterpart in Random.State. (Glen Mével and Xavier Leroy, review by Gabriel Scherer, Xavier Leroy, Florian Angeletti)

  • #12459: Random: Restore compatibility between 32-bit integers (JavaScript) and 63-bit integers (64-bit OCaml). For Random.full_int this was guaranteed in 4.14 but wrongly removed in 5.0. (Xavier Leroy, review by Glen Mével)

  • #12511: Minor performance improvements and cleanups in the implementation of modules Int32, Int64, and Nativeint (Xavier Leroy, review by Gabriel Scherer and Daniel Bünzli)

  • #12558: Adapt GC alarms for Multicore and fix their documentation. (Guillaume Munch-Maccagnoni, review by KC Sivaramakrishnan and Gabriel Scherer)

  • #12625: Remove the Closure module from Obj (Vincent Laviron, review by Xavier Leroy)

  • #12758, #12998: Remove the Marshal.Compression flag to the Marshal.to_* functions. The compilers are still able to use ZSTD compression for compilation artefacts. This is a forward port and clean-up of the emergency fix that was introduced in OCaml 5.1.1 by #12734. (Xavier Leroy, review by Damien Doligez)

  • #12784: Fix computation of minor-heap allocation in Gc.counters() and Gc.allocated_bytes(). (Nick Barnes, review by Gabriel Scherer)

  • #12770: Add Fun.compose. (Justin Frank, review by Nicolás Ojeda Bär, Daniel Bünzli, and Jeremy Yallop)

  • #12845: Add {In,Out}_channel.is_binary_mode as the dual of set_binary_mode. This function was previously only available in the internal C API. (David Allsopp, review by Nicolás Ojeda Bär and Xavier Leroy)

Type System:

  • #12313, #11799: Do not rebuild as-pattern types when a ground type annotation is given. This allows to work around problems with GADTs in as-patterns. (Jacques Garrigue, report by Leo White, review by Gabriel Scherer)

Code Generation and Optimisations:

  • #11239: On x86-64 and RISC-V, reduce alignment of OCaml stacks from 16 to 8. This reduces stack usage. It's only C stacks that require 16-alignment. (Xavier Leroy, review by Gabriel Scherer and Stephen Dolan)

  • #12311: On POWER, 32-bit FP numbers stored in memory (e.g., in Bigarrays) were not correctly rounded sometimes. (Xavier Leroy, review by Anil Madhavapeddy and Tim McGilchrist)

  • #12551, #12608, #12782, #12596: Overhaul of recursive value compilation. Non-function recursive bindings are now forbidden from Lambda onwards, and they're compiled using a new Value_rec_compiler module. (Vincent Laviron and Lunia Ayanides, review by Gabriel Scherer, Stefan Muenzel and Nathanaëlle Courant)

  • #1809, #12181: Rewrite compare x y op 0 to x op y when values are integers (Xavier Clerc, Stefan Muenzel, review by Gabriel Scherer and Vincent Laviron)

  • #12825: Disable common subexpression elimination for atomic loads... again. (Gabriel Scherer, review by KC Sivaramakrishnan, Xavier Leroy and Vincent Laviron, report by Vesa Karvonen)

Other Libraries:

  • #12213: Dynlink library, improve legibility of error messages (Samuel Hym, review by Gabriel Scherer and Nicolás Ojeda Bär)
  • (Breaking Change) #12686: Runtime_events library, C API: define caml_runtime_events_{start,pause,resume} as returning void instead of value. (Xavier Leroy, review by David Allsopp)

Compiler User-Interface and Warnings:

  • #11989, #12246, RFC 31: New flag, -H, to allow for transitive dependencies without including them in the initial environment. (Chris Casinghino, François Bobot, and Gabriel Scherer, review by Leo White and Stefan Muenzel, RFC by François Bobot)
  • (Breaking Change) #10613, #12405: Simplify the values used for the system variable (system: in ocamlopt -config or the Config.system constant). In particular, s390x and ppc64 now report "linux" instead of "elf"; all variants of 32-bit ARM on Linux now report "linux"; OpenBSD now reports "openbsd" instead of "bsd" for 32-bit ARM; FreeBSD, NetBSD, and OpenBSD now report the same value for both x86_64 and x86_32; x86_32 systems matching BSD but not FreeBSD, NetBSD*, or OpenBSD* are no longer identified (as on x86_64); x86_32 Linux now reports "linux" instead of "linux_elf". (David Allsopp, request by Kate Deplaix, review by Sébastien Hinderer and Xavier Leroy)
  • #12247: Configure: --disable-ocamldebug can now be used instead of --disable-debugger (which remains available for compatibility) (Gabriel Scherer, review by Damien Doligez and Sébastien Hinderer)

  • #12199: Improve the error message for non-overriding inherit! (Florian Angeletti, review by Jules Aguillon)

  • #12210: Uniform style for inline code in compiler messages (Florian Angeletti, review by Gabriel Scherer)

  • (Breaking Change) #12278, #:12325: Remove the OCAML_FLEXLINK environment variable from the compiler drivers. This environment variable was previously used as part of the FlexDLL bootstrap procedure and existed solely for that purpose. Its removal greatly simplifies both the build system and testsuite machinery. (David Allsopp, review by Sébastien Hinderer)
  • #12347: Error messages: always report missing polyvariant tags (Florian Angeletti, report by Tianbo Hao, review by Gabriel Scherer)

  • #12224: Specialised error message when trying to apply non-functor module (e.g., module M = Int(Int)) (Florian Angeletti, review by Gabriel Scherer)

  • #12451: Warning 53 (misplaced attributes) now works for all attributes. (Chris Casinghino, review by Florian Angeletti)

  • #12622: Give hints about existential types appearing in error messages (Leo White, review by Gabriel Scherer and Florian Angeletti)

  • #12671: When a class type parameter or class parameter does not match, identify which parameter in the error message, instead of saying "A type parameter" or "A parameter." (Stefan Muenzel, review by Gabriel Scherer)

  • #12679: Add more detail to the error message and manual in case of invalid module type substitutions. (Stefan Muenzel, review by Gabriel Scherer and Florian Angeletti)

  • #12750: Display the command executed to extract primitives in ocamlc -verbose (David Allsopp, review by Nicolás Ojeda Bär)

  • #12777: Add details about the actual and expected method types to the method mismatch error messages (Javier Chávarri, review by Gabriel Scherer and Florian Angeletti)

  • (Breaking Change) #12942: Fix line ordering in some module inclusion error messages (Nick Roberts, review by Florian Angeletti, report by Carl Eastlund)

Manual and Documentation:

  • #12338: Clarification of the documentation of process related function in the Unix module regarding the first element of arguments and shell's PID (Christophe Raffalli, review by Florian Angeletti)

  • #12473: Document in runtime/memory.c our current understanding of accesses to the OCaml heap from the C runtime code -- the problem of hybrid programs mixing two memory models (Gabriel Scherer and Guillaume Munch-Maccagnoni, review by Olivier Nicole and Xavier Leroy)

  • #12456: Document the incompatibility between effects, on one hand, and caml_callback and asynchronous callbacks (signal handlers, finalisers, memprof callbacks...), on the other (Guillaume Munch-Maccagnoni, review by KC Sivaramakrishnan)

  • #12694: Document in runtime/tsan.c the TSan instrumentation choices and the consequences with regard to the memory model (Olivier Nicole, review by Miod Vallat, Gabriel Scherer, Guillaume Munch-Maccagnoni and Fabrice Buoro)

  • #12802: Add manual chapter about ThreadSanitizer support (Olivier Nicole, review by Miod Vallat, Sebastien Hinderer, Fabrice Buoro, Gabriel Scherer and KC Sivaramakrishnan)

  • #12819: Clarify which runtime interactions are allowed in custom ops (Basile Clément, review by Guillaume Munch-Maccagnoni and Xavier Leroy)

  • #12840: Manual: update runtime tracing chapter for custom events (e.g., #12335) (Lucas Pluvinage, Sadiq Jaffer and Olivier Nicole, review by Gabriel Scherer, David Allsopp, Tim McGilchrist, and Thomas Leonard)

  • #13066: Update OCAMLRUNPARAM documentation for the stack size parameter l (Florian Angeletti, review by Nicolás Ojeda Bär, Tim McGilchrist, and Miod Vallat)

  • #13078: Update Format tutorial on structural boxes to mention alignment questions (Edwin Török, review by Florian Angeletti)

  • #13092: Document the existence of the [@@poll error] built-in attribute (Florian Angeletti, review by Gabriel Scherer)

Tools:

  • #12340: testsuite: collect known issues with current -short-paths implementation for existential types (Florian Angeletti, Samuel Hym, review by Florian Angeletti and Thomas Refis)

  • #12147: ocamllex: allow carriage returns at the end-of-line directives (SeungCheol Jung, review by Nicolás Ojeda Bär)

  • #12260: Fix invalid_argument on some external or module aliases in ocamlnat (Fabian Hemmer, review by Vincent Laviron)

  • #12185: New script language for ocamltest (Damien Doligez with Florian Angeletti, Sébastien Hinderer, Gabriel Scherer, review by Sébastien Hinderer and Gabriel Scherer)

  • #12371: ocamltest: fix recursive expansion of variables (Antonin Décimo, Damien Doligez, review by Sébastien Hinderer, Damien Doligez, Gabriel Scherer, and Xavier Leroy)

  • (Breaking Change) #12497, #12613: Make ocamlc/ocamlopt fail with an error when no input files are specified to build an executable (Antonin Décimo, review by Sébastien Hinderer)
  • #12576: ocamldep : various refactors (Antonin Décimo, review by Florian Angeletti, Gabriel Scherer, and Léo Andrès)

  • #12615: ocamldoc: get rid of the odoc_literate and odoc_todo generators (Sébaistien Hinderer, review by Gabriel Scherer and Florian Angeletti)

  • #12624: Use $XDG_CONFIG_DIRS in addition to $XDG_CONFIG_HOME when searching for init.ml, and use this to extend init.ml support to the toplevel when running on Windows. (David Allsopp, report by Jonah Beckford, review by Nicolás Ojeda Bär and Antonin Décimo)

  • #12688: Setting the env variable NO_COLOR with an empty value no longer has effects. Previously, setting NO_COLOR with any value, including the empty value, would disable colours (unless OCAML_COLOR is also set). After this change, the user must set NO_COLOR with an non-empty value to disable colours. This reflects a specification clarification/change from the upstream website at https://no-color.org. (Favonia, review by Gabriel Scherer)

  • #12744: ocamltest: run tests in recursive subdirs more eagerly (Nick Roberts, review by Nicolás Ojeda Bär)

  • #12901, 12908: ocamllex: add overflow checks to prevent generating incorrect lexers; use unsigned numbers in the table encoding when possible (Vincent Laviron, report by Edwin Török, review by Xavier Leroy)

Internal/compiler-libs Changes:

  • #12508 : Add compiler-side support for project-wide occurrences in Merlin by generating index tables of all identifier occurrences. This extra data in .cmt files is only added when the new flag -bin-annot-occurrences is passed. (Ulysse Gérard, Nathanaëlle Courant, suggestions by Gabriel Scherer and Thomas Refis, review by Florian Angeletti, Gabriel Scherer, and Thomas Refis)

  • #12236, #12386, #12391, #12496, #12673: Use syntax as sole determiner of arity. This changes function arity to be based solely on the source program's parsetree. Previously, the heuristic for arity had more subtle heuristics that involved type information about patterns. Function arity is important because it determines when a pattern match's effects run and is an input into the fast path for function application.

    This change affects tooling; it changes the function constructs in parsetree and typedtree.

    See https://github.com/ocaml/RFCs/pull/32 for the original RFC.

    (Nick Roberts; review by Richard Eisenberg, Leo White, and Gabriel Scherer; RFC by Stephen Dolan)

  • #12639: Parsing: attach a location to the RHS of Ptyp_alias and improve the 'alias type mismatch' error message. (Jules Aguillon, review by Florian Angeletti)

  • #12447: Remove 32-bit targets from X86_proc.system (Masanori Ogino, review by David Allsopp)

  • #12216, #12248: Prevent reordering of atomic loads during instruction scheduling. This is for reference, as instruction scheduling is currently unused in OCaml 5. (Xavier Leroy, report by Luc Maranget and KC Sivaramakrishnan, review by Nicolás Ojeda Bär)

  • #12025: Split Typecore.unify_pat_types into two in order to avoid unnecessary references to the environment in type_pat (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer)

  • #12031: Use dedicated types to represent names of compilation units and predefined exceptions in CMO files. (Sébastien Hinderer, review by Florian Angeletti, Thomas Refis, Gabriel Scherer, Vincent Laviron, Pierre Chambart, Luke Maurer, Hugo Heuzard, Xavier Leroy, and Damien Doligez)

  • #12109: Pack parameters to unification in unification_environment (Takafumi Saikawa and Jacques Garrigue, review by Richard Eisenberg)

  • #12331, #12361: Pack the unification data for pattern checking in Typecore (Takafumi Saikawa and Jacques Garrigue, review by Gabriel Scherer, Thomas Refis, and Florian Angeletti)

  • #12229: Remove global mutable state for typechecking patterns in Typecore in favor of local mutable state. (Nick Roberts, review by Takafumi Saikawa)

  • #12542: Minor bugfix to #12236: restore dropped call to instance (Nick Roberts, review by Jacques Garrigue)

  • #12242: Move the computation of stack frame parameters to a separate Stackframe module, and save the parameters in the results of the Linearize pass. (Xavier Leroy, review by KC Sivaramakrishnan and Mark Shinwell)

  • #12442: Document jump summaries in the pattern-matching compiler (Gabriel Scherer and Thomas Refis, review by Florian Angeletti and Vincent Laviron)

  • #12446, #12792: Remove the hooks machinery around channel locking in runtime/io.c (Gabriel Scherer, review by Xavier Leroy)

  • #12389, #12544, #12984, #12987: Centralise the handling of metadata for compilation units and artifacts in preparation to improve Unicode support for OCaml source files. (Florian Angeletti, review by Vincent Laviron and Gabriel Scherer)

  • #12532, #12553: Improve readability of the pattern-matching debug output (Gabriel Scherer, review by Thomas Refis)

  • #12537: Use C11/C++11 standard static assertion (Antonin Décimo, review by Sebastien Hinderer, Xavier Leroy, and KC Sivaramakrishnan)

  • #12169: Runtime: document and enforce naming conventions around STW sections (Gabriel Scherer, review by Enguerrand Decorne, Miod Vallat, B. Szilvasy and Nick Barnes, report by KC Sivaramakrishnan)

  • #12669 : Clean up some global state handling in schedgen (Stefan Muenzel, review by Miod Vallat and Gabriel Scherer)

  • #12640: Make the module separator used in symbol names configurable (Miod Vallat, review by Hugo Heuzard and Xavier Leroy)

  • #12691 : Clean up Ctype.expand_abbrev_gen and rename Env.add_local_type to add_local_constraint (Takafumi Saikawa and Jacques Garrigue, review by Florian Angeletti)

  • #12786 : Clean up the algorithm of Ctype.limited_generalize (Takafumi Saikawa and Jacques Garrigue, review by Gabriel Scherer)

  • #10691: Ast_mapper, Ast_iterator: add functions directive_argument, toplevel_directive, and toplevel_phrase (Guillaume Petiot, review by Gabriel Scherer and Kate Deplaix)

  • #12764: Move all installable headers in caml/ subdirectories. (Antonin Décimo, review by Gabriel Scherer and David Allsopp)

  • #12914: Slightly change the s390x assembly dialect in order to build with Clang's integrated assembler (Miod Vallat, review by Gabriel Scherer)

  • #13001: Do not read_back entire shapes to get aliases' UIDs when building the usages index (Ulysse Gérard, review by Gabriel Scherer and Nathanaëlle Courant)

Build System:

  • #12198, #12321, #12586, #12616, #12706, #13048: Continue the merge of the sub-Makefiles into the root Makefile started with #11243, #11248, #11268, #11420 and #11675. (Sébastien Hinderer, review by David Allsopp and Florian Angeletti)

  • #12569, #12570: Remove otherlibraries as a prerequisite for runtop; use runtop-with-otherlibs to use a library from otherlibs/ (Gabriel Scherer, review by Sébastien Hinderer, suggestion by David Allsopp)

  • #12652: Make magic numbers easier to bump and duplicate (Sébastien Hinderer, review by Antonin Décimo, David Allsopp and Florian Angeletti)

  • (Breaking Change) #12751: --with-target-bindir configure option implemented. This option refers to the location of the runtime binaries on the target system for a cross-compiler and is embedded in executables produced by ocamlc. It does not affect the bytecode executables installed as part of the build. The old mechanism make TARGET_BINDIR=.. no longer works. (David Allsopp, review by Damien Doligez, Xavier Leroy, and Olivier Nicole)
  • #12768, #13030: Detect MinGW-w64 coupling with GCC or LLVM, detect clang-cl, and fix C compiler feature detection on macOS. (Antonin Décimo, review by Miod Vallat and Sébastien Hinderer)

Bug Fixes:

  • #10652, #12720: Fix evaluation order in presence of optional arguments (Jacques Garrigue, report by Leo White, review by Vincent Laviron)

  • #12595, #12597: Fix a race in caml_clear_gc_stats_sample (Gabriel Scherer, review by B. Szilvasy, report by B. Szilvasy)

  • #12580: Fix location of alias pattern variables (Chris Casinghino, review Gabriel Scherer, report by Milo Davis)

  • #12583: Add a closing event for when EV_MAJOR_EPHE_MARK is complete (Sudha Parimala, review by Gabriel Scherer)

  • #12566: caml_output_value_to_malloc wrongly uses caml_stat_alloc instead of malloc since 4.06, breaking (in pooled mode) user code that uses free on the result. Symmetrically, caml_input_value_from_malloc should use free. (Gabriel Scherer, review by Xavier Leroy and Enguerrand Decorne, report by Ido Yariv)

  • #12490: Unix: protect the popen_processes hashtable with a mutex (Gabriel Scherer, report by Olivier Nicole, review by Xavier Leroy)

  • #11931: Fix tricky typing bug with type substitutions (Stephen Dolan, review by Leo White and Jacques Garrigue)

  • #12037, #12171: Fix get_extern_state potential NULL dereference (Alexander Skvortsov, report by Török Edwin, design by Gabriel Scherer, Xavier Leroy)

  • #12635: Fix get_intern_state potential NULL dereference (Antonin Décimo, review by KC Sivaramakrishnan)

  • #12032, #12059: Bug fixes related to compilation of recursive definitions (Vincent Laviron, report by Victoire Noizet, review by Gabriel Scherer)

  • (Breaking Change) #12145: Loopy constraints cause ocamlc to loop. Fixed by completely removing the call to update_type in Typedecl.transl_type_decl, as the expansion is already checked by check_regularity. As a result, recursion is more polymorphic, which may cause some (essentially wrong) type declarations to have unbound type variables and some constraints unrelated to the concrete type to be ignored (see tests/typing-misc/constraints.ml). (Jacques Garrigue, report by Richard Eisenberg, review by Leo White)
  • #12207, #12222: Make closure computation linear in the number of recursive functions instead of quadratic (Vincent Laviron, report by François Pottier, review by Nathanaëlle Courant and Gabriel Scherer)

  • #11040, #12591: Fix a data race in major_gc.c (Gabriel Scherer, review by Guillaume Munch-Maccagnoni and KC Sivaramakrishnan, report by Sadiq Jaffer)

  • #12238, #12403, #12698: Read input files in one go to avoid source reprinting issues (Gabriel Scherer, report by Mike Spivey and Vincent Laviron, review by Nicolás Ojeda Bär, Xavier Leroy and Jeremy Yallop)

  • #12334, #12368: Bad error message with mutually recursive abbreviations (Jacques Garrigue, report by Richard Eisenberg, review by Gabriel Scherer and Richard Eisenberg)

  • #12401: seek_in and seek_out sometimes returned normally when given negative offsets, instead of failing. Now both functions should consistently raise Sys_error in this case. (Nicolás Ojeda Bär, review by Gabriel Scherer)

  • #12267: Fix stack alignment computation (Miod Vallat, report by Jan Midtgaard, review by Gabriel Scherer)

  • #12395, #12404: Fix thread-unsafety in the fallback implementation of Unix.create_process (the one used when posix_spawnp is unavailable) (Xavier Leroy, report by Chris Vine, review by Nicolás Ojeda Bär)

  • #12949: Open shadowing mistriggers (Gabriel Scherer, review by Florian Angeletti, report by Andreas Rossberg)

  • #12526: Honor ocaml.inline always attribute on functions with optional arguments and default values in the Closure backend (Alain Frisch, review by Vincent Laviron)

  • #12677, #12889: Make Domain.DLS thread-safe (Gabriel Scherer, review by Olivier Nicole and Damien Doligez, report by Vesa Karvonen)

  • #12561: Fix crash when combining TSan and frame-pointers (Fabrice Buoro and Olivier Nicole, report by Jan Midtgaard, review by Miod Vallat and Gabriel Scherer)

  • #12482: Rework bounds checking code in the POWER backend (Miod Vallat and Xavier Leroy, report by Jan Midtgaard, review by KC Sivaramakrishnan)

  • #12528, #12703: Avoid pointer arithmetic overflow in Tag_val macro (very likely harmless, but can trigger alarms) (Xavier Leroy, report by Sam Goldman, review by Guillaume Munch-Maccagnoni)

  • #12593: TSan should handle Effect.Unhandled correctly (Fabrice Buoro and Olivier Nicole, report by Jan Midtgaard and Miod Vallat, review by Gabriel Scherer)

  • #12684: Fix locations filename in AST produced by the -pp option (Gabriel Scherer, review by Florian Angeletti)

  • #12714: Check whether macros are defined before using them to ensure that the headers can always be used in code which turns on -Wundef (or equivalent). (Antonin Décimo, review by Miod Vallat, Gabriel Scherer, Xavier Leroy, and David Allsopp)

  • #12726: Fix segmentation fault under Windows when executing a bytecode file if the runtime (ocamlrun.exe) cannot be found. (Vadim Zborovskii, Nicolás Ojeda Bär, report by Vadim Zborovskii, review by David Allsopp)

  • #12727, #12730: Fix bug with value let-rec and labelled applications (Vincent Laviron, review by Gabriel Scherer)

  • (Breaking Change) #12751: Always keep within the 128 character limit for shebang lines. Previous fix in #8622 handled building the compiler with a long prefix. This patch extends this to the bytecode executables emitted by that compiler. (David Allsopp, review by Damien Doligez, Xavier Leroy, and Olivier Nicole)
  • #12755: Fix data race on global pools arrays of pool_freelist (Fabrice Buoro and Olivier Nicole, review by Gabriel Scherer)

  • #12796, #12801: Fix memory corruption in caml_unix_alloc_sockaddr (Thomas Leonard, review by Nicolás Ojeda Bär)

  • #12737: Fix data races in minor_gc.c and caml_natdynlink_open (Olivier Nicole, review by Stefan Muenzel, Miod Vallat, Guillaume Munch-Maccagnoni, Gabriel Scherer, and Xavier Leroy)

  • #12831: Fix call to caml_call_realloc_stack for s390x in PIC mode (Vincent Laviron, report by Jerry James, review by Miod Vallat)

  • (Breaking Change) #12837: Show non-generalisable type parameters in type definitions Changes type of type parameters in outcometree.mli. (Jacques Garrigue, review by Richard Eisenberg)
  • #12897: Fix locking bugs in Runtime_events (Gabriel Scherer and Thomas Leonard, review by Olivier Nicole, Vincent Laviron, and Damien Doligez, report by Thomas Leonard)

  • #12851: Fix race between runtime events teardown and event emission (Olivier Nicole, review by Miod Vallat and Gabriel Scherer)

  • #12860: Fix an assertion that wasn't taking into account the possibility of an ephemeron pointing at static data (Mark Shinwell, review by Gabriel Scherer and KC Sivaramakrishnan)

  • #12861: Fix a possible crash in the threads library (Mark Shinwell, review by Gabriel Scherer and KC Sivaramakrishnan)

  • #11040, #12894: Silence false data race observed between caml_shared_try_alloc and oldify. Introduces macros to call TSan annotations which help annotate a "happens before" relationship. (Hari Hara Naveen S and Olivier Nicole, review by Gabriel Scherer and Miod Vallat)

  • #12958: Fix tail-modulo-cons compilation of try-with, &&, and || expressions. (Gabriel Scherer and Nicolás Ojeda Bär, report by Sylvain Boilard, review by Gabriel Scherer)

  • #12919: Fix register corruption in caml_callback2_asm on s390x. (Miod Vallat, review by Gabriel Scherer)

  • #12924, #12930: Rework package constraint checking to improve interaction with immediacy (Chris Casinghino and Florian Angeletti, review by Florian Angeletti and Richard Eisenberg)

  • #12969: Fix a data race in caml_darken_cont (Fabrice Buoro and Olivier Nicole, review by Gabriel Scherer and Miod Vallat)

  • #12971, #12974: Fix an uncaught Ctype.Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

  • #13019: Remove linking instructions for the Unix library from threads.cma. (This was done for threads.cmxa in OCaml 3.11.) Eliminates warnings from new LLD when using threads.cma of duplicated libraries. (David Allsopp, review by Nicolás Ojeda Bär)

  • #13058: Add TSan instrumentation to caml_call_gc(), since it may raise exceptions. (Fabrice Buoro, Olivier Nicole, Gabriel Scherer, and Miod Vallat)

  • #13079: Save and restore frame pointer across Iextcall on ARM64 (Tim McGilchrist, review by KC Sivaramakrishnan and Miod Vallat)

  • #13094: Fix undefined behavior of left-shifting a negative number (Antonin Décimo, review by Miod Vallat and Nicolás Ojeda Bär)

  • #13130: Minor fixes to Pprintast for raw identifiers and local module open syntax for types (Chet Murthy, review by Gabriel Scherer)

The release of OCaml 5.2.0 is imminent. As a final step, we are publishing a release candidate to check that everything is in order before the release in the upcoming week(s).

If you find any bugs, please report them on OCaml's issue tracker.

Compared to the second beta, this release contains one small compiler-libs printer fix and one configuration tweak.

The full change log for OCaml 5.2.0 is available on GitHub. A short summary of the changes since the second beta release is also available below.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later:

opam update
opam switch create 5.2.0~rc1

The source code for the release candidate 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.2.0~rc1+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.2.0~rc1+flambda+nffa ocaml-variants.5.2.0~rc1+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Changes since the second beta

  • #13130: Minor fixes to pprintast for raw identifiers and local module open syntax for types. (Chet Murthy, review by Gabriel Scherer)

  • #13100 Fix detection of zstd when compiling with musl-gcc (David Allsopp, review by Samuel Hym)

Last week, we merged an update to the compiler-libs "shape" API for querying definition information from the compiler.

Unfortunately, this small change of API breaks compatibility with at least odoc. Generally, we try to avoid this kind of changes during the beta releases of the compiler. However, after discussions we concluded that it will be easier on the long term to fix the API right now in order to avoid multiplying the number of supported versions of the shape API in the various OCaml developer tools .

We have thus released a second beta version of OCaml 5.2.0 to give the time to developer tools to update their 5.2.0 version ahead of the release (see below for the installation instructions).

Beyond this changes of API, the new beta contains three more bug fixes and three documentation updates, which is a good sign in term of stability.

As usual, you can follow the last remaining compatibility slags on the opam readiness for 5.2.0 meta-issue.

If you find any bugs, please report them on OCaml's issue tracker.

Currently, the release is planned for the beginning of May.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.2.0 is available on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 5.2.0~beta2

The source code for the beta is also available at these addresses:

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.2.0~beta2+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.2.0~beta2+flambda+nffa ocaml-variants.5.2.0~beta2+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Compiler-libs API Changes

  • #13001: do not read_back entire shapes to get aliases' uids when building the usages index (Ulysse Gérard, review by Gabriel Scherer and Nathanaëlle Courant)

Bug Fixes

  • #13058: Add TSan instrumentation to caml_call_gc(), since it may raise exceptions. (Fabrice Buoro, Olivier Nicole, Gabriel Scherer and Miod Vallat)

  • #13079: Save and restore frame pointer across Iextcall on ARM64 (Tim McGilchrist, review by KC Sivaramakrishnan and Miod Vallat)

  • #13094: Fix undefined behavior of left-shifting a negative number. (Antonin Décimo, review by Miod Vallat and Nicolás Ojeda Bär)

Documentation Updates

  • #13078: update Format tutorial on structural boxes to mention alignment questions. (Edwin Török, review by Florian Angeletti)

  • #13092: document the existence of the [@@poll error] built-in attribute (Florian Angeletti, review by Gabriel Scherer)

  • #13066, update OCAMLRUNPARAM documentation for the stack size parameter l (Florian Angeletti, review by Nicolás Ojeda Bär, Tim McGilchrist, and Miod Vallat)

Nearly two months after the first alpha release, the release of OCaml 5.2.0 is drawing near.

We have thus released a first beta version of OCaml 5.2.0 to help you update your softwares and libraries ahead of the release (see below for the installation instructions).

Compared to the alpha release, this beta contains a majority of runtime system fixes, and a handful of other fixes across many subsystems.

Overall, the opam ecosystem looks in a good shape for the first beta release. Most core development tools support OCaml 5.2.0, and you can follow the last remaining wrinkles on the opam readiness for 5.2.0 meta-issue.

If you find any bugs, please report them on OCaml's issue tracker.

Currently, the release is planned for the end of April or the beginning of May.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.2.0 is available on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 5.2.0~beta1

The source code for the alpha is also available at these addresses:

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.2.0~beta1+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.2.0~beta1+flambda+nffa ocaml-variants.5.2.0~beta1+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Runtime System Fixes

  • #12875, #12879, #12882: Execute preemptive systhread switching as a delayed pending action. This ensures that one can reason within the FFI that no mutation happens on the same domain when allocating on the OCaml heap from C, consistently with OCaml 4. This also fixes further bugs with the multicore systhreads implementation. (Guillaume Munch-Maccagnoni, bug reports and suggestion by Mark Shinwell, review by Nick Barnes and Stephen Dolan)

  • #12876: Port ThreadSanitizer support to Linux on POWER (Miod Vallat, review by Tim McGilchrist)

  • #12678, #12898: free channel buffers on close rather than on finalization (Damien Doligez, review by Jan Midtgaard and Gabriel Scherer, report by Jan Midtgaard)

  • #12915: Port ThreadSanitizer support to Linux on s390x (Miod Vallat, review by Tim McGilchrist)

  • #12914: Slightly change the s390x assembly dialect in order to build with Clang's integrated assembler. (Miod Vallat, review by Gabriel Scherer)

  • #12897: fix locking bugs in Runtime_events (Gabriel Scherer and Thomas Leonard, review by Olivier Nicole, Vincent Laviron and Damien Doligez, report by Thomas Leonard)

  • #12860: Fix an assertion that wasn't taking into account the possibility of an ephemeron pointing at static data. (Mark Shinwell, review by Gabriel Scherer and KC Sivaramakrishnan)

  • #11040, #12894: Silence false data race observed between caml_shared_try_alloc and oldify. Introduces macros to call tsan annotations which help annotate a ``happens before'' relationship. (Hari Hara Naveen S and Olivier Nicole, review by Gabriel Scherer and Miod Vallat)

  • #12919: Fix register corruption in caml_callback2_asm on s390x. (Miod Vallat, review by Gabriel Scherer)

  • #12969: Fix a data race in caml_darken_cont (Fabrice Buoro and Olivier Nicole, review by Gabriel Scherer and Miod Vallat)

Standard Library Fix

  • #12677, #12889: make Domain.DLS thread-safe (Gabriel Scherer, review by Olivier Nicole and Damien Doligez, report by Vesa Karvonen)

Type System Fix

  • #12924, #12930: Rework package constraint checking to improve interaction with immediacy (Chris Casinghino and Florian Angeletti, review by Florian Angeletti and Richard Eisenberg)

Compiler User-Interface Fix

  • #12971, #12974: fix an uncaught Ctype.Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

Build System Fixes

  • #12198, #12321, #12586, #12616, #12706, +#13048: continue the merge of the sub-makefiles into the root Makefile started with #11243, #11248, #11268, #11420 and #11675. (Sébastien Hinderer, review by David Allsopp and Florian Angeletti)

  • #12768, +#13030: Detect mingw-w64 coupling with GCC or LLVM, detect clang-cl, and fix C compiler feature detection on macOS. (Antonin Décimo, review by Miod Vallat and Sébastien Hinderer)

  • #13019: Remove linking instructions for the Unix library from threads.cma (this was done for threads.cmxa in OCaml 3.11). Eliminates warnings from new lld when using threads.cma of duplicated libraries. (David Allsopp, review by Nicolás Ojeda Bär)

  • #12758, +#12998: Remove the Marshal.Compression flag to the Marshal.to_* functions. The compilers are still able to use ZSTD compression for compilation artefacts. This is a forward port and clean-up of the emergency fix that was introduced

Compiler Internals Fix

  • #12389, #12544, #12984, +#12987: centralize the handling of metadata for compilation units and artifacts in preparation for better unicode support for OCaml source files. (Florian Angeletti, review by Vincent Laviron and Gabriel Scherer)

We have the pleasure of celebrating the birthday of Grace Chisholm Young by announcing the release of OCaml version 4.14.2.

This release is a collection of safe bug fixes, cherry-picked from the OCaml 5 branch. If you are still using OCaml 4.14 and cannot yet upgrade to OCaml 5, this release is for you.

The 4.14 branch is expected to receive updates for at least one year, while the OCaml 5 branch is stabilising.

Thus don't hesitate to report any bugs on the OCaml issue tracker.

See the list of changes below for more details.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands:

opam update
opam switch create 4.14.2

The source code for the release candidate is also directly available on:

See full changelog

Changes in OCaml 4.14.2 (14 March 2024)

Runtime system:

  • #11764, #12577: Add prototypes to old-style C function definitions and declarations. (Antonin Décimo, review by Xavier Leroy and Nick Barnes)

  • #11763, #11759, #11861, #12509, #12577: Use strict prototypes on primitives. (Antonin Décimo, review by Xavier Leroy, David Allsopp, Sébastien Hinderer and Nick Barnes)

  • (breaking change) #10723: do not use -flat-namespace linking for macOS. (Carlo Cabrera, review by Damien Doligez)
  • #11332, #12702: make sure Bool_val(v) has type bool in C++ (Xavier Leroy, report by ygrek, review by Gabriel Scherer)

Build system:

  • #11590: Allow installing to a destination path containing spaces. (Élie Brami, review by Sébastien Hinderer and David Allsopp)

  • #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3 so that code sections remain readable, as needed for closure marshaling. (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and Sébastien Hinderer)

  • #12903: Disable control flow integrity on OpenBSD >= 7.4 to avoid illegal instruction errors on certain CPUs. (Michael Hendricks, review by Miod Vallat)

Bug fixes:

  • #12061, #12063: don't add inconsistent equalities when computing high-level error messages for functor applications and inclusions. (Florian Angeletti, review by Gabriel Scherer)

  • #12878: fix incorrect treatment of injectivity for private recursive types. (Jeremy Yallop, review by Gabriel Scherer and Jacques Garrigue)

  • #12971, #12974: fix an uncaught Ctype.Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

  • #12264, #12289: Fix compact_allocate to avoid a pathological case that causes very slow compaction. (Damien Doligez, report by Arseniy Alekseyev, review by Sadiq Jaffer)

  • #12513, #12518: Automatically enable emulated fma for Visual Studio 2019+ to allow configuration with either pre-Haswell/pre-Piledriver CPUs or running in VirtualBox. Restores parity with the other Windows ports, which don't require explicit --enable-imprecise-c99-float-ops. (David Allsopp, report by Jonah Beckford and Kate Deplaix, review by Sébastien Hinderer)

  • #11633, #11636: bugfix in caml_unregister_frametable (Frédéric Recoules, review by Gabriel Scherer)

  • #12636, #12646: More prudent reinitialization of I/O mutexes after a fork() (Xavier Leroy, report by Zach Baylin, review by Enguerrand Decorne)

  • (breaking change) #10845 Emit frametable size on amd64 BSD (OpenBSD, FreeBSD, NetBSD) systems (emitted for Linux in #8805) (Hannes Mehnert, review by Nicolás Ojeda Bär)
  • #12958: Fix tail-modulo-cons compilation of try-with, && and || expressions. (Gabriel Scherer and Nicolás Ojeda Bär, report by Sylvain Boilard, review by Gabriel Scherer)

  • #12116, #12993: explicitly build non PIE executables on x86 32bits architectures (Florian Angeletti, review by David Allsopp)

  • #13018: Don't pass duplicate libraries to the linker when compiling ocamlc.opt and when using systhreads (new versions of lld emit a warning). (David Allsopp, review by Nicolás Ojeda Bär)

The release of OCaml version 4.14.2 is imminent.

OCaml 4.14.2 is a new update to the stable 4.14 branch of OCaml. This new release backports many safe bug fixes from the OCaml 5 branch and fixes a handful of compatibility issues of OCaml 4.14.1 with newer operating system versions.

A full list of bug fixes is available below.

In order to ensure that the future release works as expected, we are planning to test a release candidate during the upcoming week.

If you find any bugs, please report them here on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 4.14.2~rc1

The source code for the release candidate is 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.4.14.2~rc1+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 4.14.2~rc1+flambda+nffa ocaml-variants.4.14.2~rc1+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Changes Since OCaml 4.14.1

Runtime System:

  • #11764, #12577: Add prototypes to old-style C function definitions and declarations. (Antonin Décimo, review by Xavier Leroy and Nick Barnes)

  • #11763, #11759, #11861, #12509, #12577: Use strict prototypes on primitives. (Antonin Décimo, review by Xavier Leroy, David Allsopp, Sébastien Hinderer and Nick Barnes)

  • (breaking change) #10723: Do not use -flat-namespace linking for macOS. (Carlo Cabrera, review by Damien Doligez)
  • #11332, #12702: Make sure Bool_val(v) has type bool in C++ (Xavier Leroy, report by ygrek, review by Gabriel Scherer)

Build System:

  • #11590: Allow installing to a destination path containing spaces (Élie Brami, review by Sébastien Hinderer and David Allsopp)

  • #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3 so that code sections remain readable, as needed for closure marshaling. (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and Sébastien Hinderer)

  • #12903: Disable control flow integrity on OpenBSD >= 7.4 to avoid illegal instruction errors on certain CPUs. (Michael Hendricks, review by Miod Vallat)

Bug fixes:

  • #12061, #12063: Don't add inconsistent equalities when computing high-level error messages for functor applications and inclusions. (Florian Angeletti, review by Gabriel Scherer)

  • #12878: Fix incorrect treatment of injectivity for private recursive types. (Jeremy Yallop, review by Gabriel Scherer and Jacques Garrigue)

  • #12971, #12974: Fix an uncaught Ctype. Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

  • #12264, #12289: Fix compact_allocate to avoid a pathological case that causes very slow compaction. (Damien Doligez, report by Arseniy Alekseyev, review by Sadiq Jaffer)

  • #12513, #12518: Automatically enable emulated fma for Visual Studio 2019+ to allow configuration with either pre-Haswell/pre-Piledriver CPUs or running in VirtualBox. Restores parity with the other Windows ports, which don't require explicit --enable-imprecise-c99-float-ops. (David Allsopp, report by Jonah Beckford and Kate Deplaix, review by Sébastien Hinderer)

  • #11633, #11636: Bug fix in caml_unregister_frametable (Frédéric Recoules, review by Gabriel Scherer)

  • #12636, #12646: More prudent reinitialisation of I/O mutexes after a fork() (Xavier Leroy, report by Zach Baylin, review by Enguerrand Decorne)

  • (breaking change) #10845 Emit frametable size on AMD64 BSD (OpenBSD, FreeBSD, NetBSD) systems (emitted for Linux in #8805) (Hannes Mehnert, review by Nicolás Ojeda Bär)
  • #12958: Fix tail-modulo-cons compilation of try-with, &&, and || expressions. (Gabriel Scherer and Nicolás Ojeda Bär, report by Sylvain Boilard, review by Gabriel Scherer)

Two months after the release of OCaml 5.1.1, the set of new features for the future version 5.2.0 of OCaml has been frozen. We are thus happy to announce the first alpha release for OCaml 5.2.0.

This alpha version is here to help fellow hackers join us early in our bug hunting and opam ecosystem fixing fun (see below for the installation instructions).

The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.2.0 meta-issue. The full release is expected around April.

If you find any bugs, please report them on OCaml's issue tracker.

If you are interested in the ongoing list of new features and bug fixes, the updated change log for OCaml 5.2.0 is available on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later:

opam update
opam switch create 5.2.0~alpha1

For previous version of opam, the switch creation command line is slightly more verbose:

opam update
opam switch create 5.2.0~alpha1 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

The source code for the alpha is also available at these addresses:

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.2.0~alpha1+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.2.0~alpha1+flambda+nffa ocaml-variants.5.2.0~alpha1+options ocaml-option-flambda ocaml-option-no-flat-float-array

The command line above is slightly more complicated for opam version anterior to 2.1:

opam update
opam switch create <switch_name> --packages=ocaml-variants.5.2.0~alpha1+options,<option_list> --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

In both cases, all available options can be listed with opam search ocaml-option.

In the last three months after the release of OCaml 5.1.0, three significant regressions have been discovered in OCaml 5.1.0. Those regressions concern the packaging of executables, the typechecking of OCaml programs, and the performance of numerical codes.

Since those regressions affect many users and could have lasting effects, we have published patch release OCaml 5.1.1 fixing those issues.

As a major exception to our policy for patch releases, OCaml 5.1.1 will contain one breaking change in the standard library: the Compression flag has been removed from the Marshal module.

This drastic measure was taken because supporting ZSTD compression in the standard library made ZSTD a dependency of all OCaml executables. Since the compiler should not impose its dependency on end users, the support for compressed marshaling has been moved to a compiler internal library in 5.1.1.

Accounting for the still-experimental nature of the Multicore runtime, this patch release 5.1.1 also contains safe fixes for subtle concurrency issues in the OCaml runtime.

The full list of changes is available below for more details.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands:

opam update
opam switch create 5.1.1

The source code for the release is also directly available on:

See full changelog

Standard library:

  • (breaking change) #12562, #12734, #12783: Remove the Marshal.Compression flag to the Marshal.to_* functions introduced in 5.1 by #12006, as it cannot be implemented without risking to link -lzstd with all ocamlopt-generated executables. The compilers are still able to use ZSTD compression for compilation artefacts. (Xavier Leroy and David Allsopp, report by Kate Deplaix, review by Nicolás Ojeda Bär, Kate Deplaix, and Damien Doligez).

Runtime Bug Fixes:

  • #11800, #12707: Fix an assertion race condition in install_backup_thread (Jan Midtgaard, review by Gabriel Scherer)

  • #12486, #12535: Fix delivery of unhandled effect exceptions on AMD64 with --enable-frame-pointers (Miod Vallat, report by Jan Midtgaard, review by Gabriel Scherer)

  • #12712, #12742: Fix an assertion boundary case in caml_reset_young_limit (Jan Midtgaard, review by Guillaume Munch-Maccagnoni)

  • #12713, #12715: Disable common subexpression elimination for atomic loads (Gabriel Scherer and Vincent Laviron, review by Vincent Laviron, KC Sivaramakrishnan and Xavier Leroy, report by Vesa Karvonen and Carine Morel)

GC Performance Regression Bug Fixes:

  • #12318: GC: simplify the meaning of custom_minor_max_size: blocks with out-of-heap memory above this limit are now allocated directly in the major heap. (Damien Doligez, report by Stephen Dolan, review by Gabriel Scherer)

  • #12439: Finalise and collect dead custom blocks during minor collection (Damien Doligez, review by Xavier Leroy, Gabriel Scherer and KC Sivaramakrishnan)

  • #12590, #12595: Move caml_collect_gc_stats_sample in caml_empty_minor_heap_promote before barrier arrival. (B. Szilvasy, review by Gabriel Scherer)

  • #12491, #12493, #12500, #12754: Do not change GC pace when creating subarrays of bigarrays (Xavier Leroy, report by Ido Yariv, analysis by Gabriel Scherer, review by Gabriel Scherer and Fabrice Buoro)

Bug Fixes

  • #12581, #12609: Fix error on uses of packed modules outside their pack to correctly handle nested packs (Vincent Laviron, report by Javier Chávarri, review by Pierre Chambart)

  • #12623: Fix the computation of variance composition (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer)

  • #12645, #12649: Fix error messages for cyclic type definitions in presence of the -short-paths flag. (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer)

  • #12757: Fix ocamlnat (native toplevel) by registering frametables correctly (Stephen Dolan, Nick Barnes and Mark Shinwell, review by Vincent Laviron and Sébastien Hinderer)

  • #12791: extern is applied to definitions of caml_builtin_cprim and caml_names_of_builtin_cprim when linking bytecode -custom executables with a C++ linker. (Shayne Fletcher, review by Antonin Décimo and Xavier Leroy)

Two months (and half) after the release of OCaml 5.1.0, we have discovered three significant regressions in OCaml 5.1.0, affecting the packaging of executables, the typechecking of OCaml programs, and the performance of numerical codes.

Since those regressions affect many users and could have lasting effects, we have decided to cut a patch release of OCaml 5.1 with fixes for those issues next week.

To give time for opam packages to test this patch version, we have just published a first release candidate for OCaml 5.1.1 . The full list of changes in this release candidate is available below.

As a major exception to our policy for patch releases, OCaml 5.1.1 will contain one breaking change in the standard library: the Compression flag has been removed from the Marshal module. This drastic measure was taken because supporting zstd compression in the standard library made zstd a dependency of all OCaml executables. Since the compiler should not impose its dependency on end-users, the support for compressed marshaling has been moved to a compiler internal library in 5.1.1. This internally library might be released as an independent library in later releases of OCaml but not in OCaml 5.1.1 to give us time to polish the library integration and packaging.

Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later:

opam update
opam switch create 5.1.1~rc1

The source code for the release candidate 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.1.1~rc1+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.1.1~rc1+flambda+nffa ocaml-variants.5.1.1~rc1+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Changes in OCaml 5.1.1

Standard Library Dependency Fix:

  • (breaking change) #12562, #12734, #12783: Remove the Marshal.Compression flag to the Marshal.to_* functions introduced in 5.1 by #12006, as it cannot be implemented without risking to link -lzstd with all ocamlopt-generated executables. The compilers are still able to use ZSTD compression for compilation artefacts. (Xavier Leroy and David Allsopp, report by Kate Deplaix, review by Nicolás Ojeda Bär, Kate Deplaix, and Damien Doligez).

Type System Bug Fix:

  • #12623, fix the computation of variance composition (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer)

GC Performance Regression Fixes

  • #12590, #12595: Move caml_collect_gc_stats_sample in caml_empty_minor_heap_promote before barrier arrival. (B. Szilvasy, review by Gabriel Scherer)

  • #12318: GC: simplify the meaning of custom_minor_max_size: blocks with out-of-heap memory above this limit are now allocated directly in the major heap. (Damien Doligez, report by Stephen Dolan, review by Gabriel Scherer)

  • #12439: Finalize and collect dead custom blocks during minor collection (Damien Doligez, review by Xavier Leroy, Gabriel Scherer and KC Sivaramakrishnan)

  • #12491, #12493, #12500, #12754: Do not change GC pace when creating sub-arrays of bigarrays (Xavier Leroy, report by Ido Yariv, analysis by Gabriel Scherer,

Miscellaneous Bug Fixes

  • #12581, #12609: Fix error on uses of packed modules outside their pack to correctly handle nested packs (Vincent Laviron, report by Javier Chávarri, review by Pierre Chambart)

  • #12757: Fix ocamlnat (native toplevel) by registering frametables correctly (Stephen Dolan, Nick Barnes and Mark Shinwell, review by Vincent Laviron and Sébastien Hinderer)

  • #12645, #12649 fix error messages for cyclic type definitions in presence of the -short-paths flag. (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer)

We have the pleasure of celebrating the anniversary of Olympe de Gouges' "Declaration of the Rights of Woman and of the Female Citizen" by announcing the release of OCaml version 5.1.0.

Some of the highlights in OCaml 5.1.0 are:

  • Many runtime performance regression and memory-leaks fixes (dynlinking, weak array, weak hash sets, GC with idle domains, GC prefetching)
  • Restored support for native code generation on RISC-V and s390x architectures
  • Restored Cygwin port
  • Reduced installation size (50% reduction)
  • Compressed compilation artefacts (.cmi, .cmt, .cmti, .cmo, .cma files)
  • 19 error message improvements
  • 14 standard library functions made tail-recursive with Tail-Recursion-Modulo-Cons (TRMC), such as List.append and List.map
  • 57 new standard library functions
  • More examples in the standard library documentation
  • 42 bug fixes

OCaml 5.1.0 is still a relatively experimental release compared to the OCaml 4.14 branch. In particular:

  • The POWER port is being tested in the dev version of the compiler.
  • The Windows MSVC port is still unavailable.
  • Ephemeron performances need to be investigated.
  • GC compaction is a work in progress.
  • statmemprof is a work in progress.
  • There are a number of known runtime concurrency bugs (that trigger under rare circumstances).

We are planning to address those regressions, hopefully in time for the OCaml 5.2.0 release for some of them. Meanwhile, the OCaml 4.14 branch will be maintained, and the next release on the OCaml 4.14 branch, OCaml 4.14.2, should follow this release in the upcoming months.

Please report any unexpected behaviours on the OCaml issue tracker and post any questions or comments you might have on our discussion forums.

The full list of changes can be found in the changelog below.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands:

opam update
opam switch create 5.1.0

The source code for the release candidate 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.1.0+options <option_list>

where <option_list> is a comma-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.1.0+flambda+nffa ocaml-variants.5.0.0+options ocaml-option-flambda ocaml-option-no-flat-float-array
See full changelog

Restored backends

  • #11418, #11708: RISC-V multicore support. (Nicolás Ojeda Bär, review by KC Sivaramakrishnan)

  • #11712, #12258, #12261: s390x / IBM Z multicore support: OCaml & C stack separation; dynamic stack size checks; fiber and effects support. (Aleksei Nikiforov, with help from Vincent Laviron and Xavier Leroy, additional suggestions by Luc Maranget, review by the same and KC Sivaramakrishnan)

  • #11642: Restore Cygwin port. Add GC messages for address space reservations when OCAMLRUNPARAM option v includes 0x1000. (David Allsopp, review by Xavier Leroy, Guillaume Munch-Maccagnoni and Gabriel Scherer)

Standard library:

  • #12006, #12064: Add Marshal.Compression flag to Marshal.to_* functions. When this flag is explicitly set, marshaled data is compressed using ZSTD. On some practical examples, the marshalled output became three times smaller at no noticeable cost on the marshalling time. (Xavier Leroy, review by Edwin Török and Gabriel Scherer, fix by Damien Doligez)

  • #10464: Add List.is_empty. (Craig Ferguson, review by David Allsopp)

  • #11848: Add List.find_mapi, List.find_index: ('a -> bool) -> 'a list -> int option, Seq.find_mapi, Seq.find_index, Array.find_mapi, Array.find_index, Float.Array.find_opt, Float.Array.find_index, Float.Array.find_map, Float.Array.find_mapi. (Sima Kinsart, review by Daniel Bünzli and Nicolás Ojeda Bär)

  • #11410: Add Set.to_list, Map.to_list, Map.of_list, Map.add_to_list: key -> 'a -> 'a list t -> 'a list t. (Daniel Bünzli, review by Nicolás Ojeda Bär and Gabriel Scherer)

  • #11836, #11837: Add Array.map_inplace, Array.mapi_inplace, Float.Array.mapi_inplace and Float.Array.mapi_inplace. (Léo Andrès, review by Gabriel Scherer, KC Sivaramakrishnan and Nicolás Ojeda Bär)

  • #10967: Add Filename.temp_dir. (David Turner, review by Anil Madhavapeddy, Valentin Gatien-Baron, Nicolás Ojeda Bär, Gabriel Scherer, and Daniel Bünzli)

  • #11246: Add "hash" and "seeded_hash" functions to Bool, Int, Char, Float, Int32, Int64, and Nativeint. (Nicolás Ojeda Bär, review by Xavier Leroy and Gabriel Scherer)

  • #11488: Add Mutex.protect: Mutex.t -> (unit -> 'a) -> 'a for resource-safe critical sections protected by a mutex. (Simon Cruanes, review by Gabriel Scherer, Xavier Leroy, Guillaume Munch-Maccagnoni)

  • #11581: Add type equality witness type (_, _) eq = Equal: ('a, 'a) eq in a new module Stdlib.Type. (Nicolás Ojeda Bär, review by Daniel Bünzli, Jacques Garrigue, Florian Angeletti, Alain Frisch, Gabriel Scherer, Jeremy Yallop and Xavier Leroy)

  • #11843: Add In_channel.input_lines and In_channel.fold_lines. (Xavier Leroy, review by Nicolás Ojeda Bär and Wiktor Kuchta).

  • #11856, #11859: Using TRMC, the following Stdlib functions are now tail-recursive: Stdlib.(@), List.append, List.concat_map. (Jeremy Yallop, review by Daniel Bünzli, Anil Madhavapeddy, Nicolás Ojeda Bär, Gabriel Scherer, and Bannerets)

  • #11362, #11402: Using TRMC, the following Stdlib functions are now tail-recursive: List.map, List.mapi, List.map2, List.filter, List.filteri, List.filter_map, List.init, List.of_seq. (Nicolás Ojeda Bär, review by Xavier Leroy and Gabriel Scherer)

  • #11878, #11965: Prevent seek_in from marking buffer data as valid after closing the channel. This could lead to inputting uninitialized bytes. (Samuel Hym, review by Xavier Leroy and Olivier Nicole)

  • #11128: Add In_channel.isatty, Out_channel.isatty. (Nicolás Ojeda Bär, review by Gabriel Scherer and Florian Angeletti)

  • #10859: Add Format.pp_print_iter and Format.pp_print_array. (Léo Andrès and Daniel Bünzli, review by David Allsopp and Hugo Heuzard)

  • #10789: Add Stack.drop (Léo Andrès, review by Gabriel Scherer)

  • (breaking change) #10899: Change Stdlib.nan from signaling NaN to quiet NaN. (Greta Yorsh, review by Xavier Leroy, Guillaume Melquiond and Gabriel Scherer)
  • #11026, #11667, #11858: Rename the type of the accumulator of fold functions to 'acc: fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a list -> 'acc fold_right : ('a -> 'acc -> 'acc) -> 'a list -> 'acc -> 'acc fold_left_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a list -> 'acc * 'b list ... (Valentin Gatien-Baron and Francois Berenger, review by Gabriel Scherer and Nicolás Ojeda Bär)

  • #11354: Hashtbl.find_all is now tail-recursive. (Fermín Reig, review by Gabriel Scherer)

  • #11500: Make Hashtbl.mem non-allocating. (Simmo Saan, review by Nicolás Ojeda Bär)

  • #11412: Add Sys.is_regular_file (Xavier Leroy, review by Anil Madhavapeddy, Nicolás Ojeda Bär, David Allsopp)

  • #11322, #11329: serialization functions Random.State.{of,to}_binary_string between Random.State.t and string (Gabriel Scherer, report by Yotam Barnoy, review by Daniel Bünzli, Damien Doligez, Hugo Heuzard and Xavier Leroy)

  • #11830: Add Type.Id with val provably_equal : 'a Type.Id.t -> 'b Type.Id.t -> ('a, 'b) Type.eq option (Daniel Bünzli, review by Jeremy Yallop, Gabriel Scherer, Wiktor Kuchta, Nicolás Ojeda Bär)

  • #12184, #12320: Sys.rename Windows fixes on directory corner cases. (Jan Midtgaard, review by Anil Madhavapeddy)

  • (breaking change) #11565: Enable -strict-formats by default. Some incorrect format specifications (for printf) where silently ignored and now fail. Those new failures occur at compile-time, except if you use advanced format features like %(...%) that parse format strings dynamically. Pass -no-strict-formats to revert to the previous lenient behavior. (Nicolás Ojeda Bär, review by David Allsopp)

Installation size

Specific efforts have been made during this release to reduce the filesystem size of installed artifacts of the compiler distribution. The installation size of 5.1 is 272 MiB compared to 521 MiB for 5.0. Some of those changes will benefit all OCaml packages.

  • ocaml/RFCs#23, #12006: use compressed marshaled format from #12006 for .cmi, .cmt, .cmti files, and for debug info in .cmo and .cma files, resulting in major reduction in size. (Xavier Leroy, review by Edwin Török and Gabriel Scherer, RFC by Simon Cruanes)

  • #11981: Reduce size of OCaml installations by removing debugging information from installed bytecode executables. It is no longer possible to run ocamldebug over these installed bytecode executables, nor to get exception backtraces for them. (Xavier Leroy, review by David Allsopp, report by Fabrice Le Fessant)

  • (breaking change) #11993: install only bytecode executables for the ocamlmklib, ocamlcmt, ocamlprof, ocamlcp, ocamloptp, and ocamlmktop tools, but no native-code executables. A tool like ocamlmklib for example is now installed directly to $BINDIR/ocamlmklib; ocamlmklib.byte and ocamlmklib.opt are no longer installed to $BINDIR. (Xavier Leroy, review by Gabriel Scherer)

Runtime system:

  • #11589, #11903: Modify the GC pacing code to make sure the GC keeps up with allocations in the presence of idle domains. (Damien Doligez and Stephen Dolan, report by Florian Angeletti, review by KC Sivaramakrishnan and Sadiq Jaffer)

  • #11743: Speed up weak array operations (KC Sivaramakrishnan, review by François Bobot and Sadiq Jaffer)

  • #12131: Simplify implementation of weak hash sets, fixing a performance regression. (Nick Barnes, review by François Bobot, Alain Frisch and Damien Doligez).

  • #11474, #11998, #12065: Add support for user-defined events in the runtime event tracing system. (Lucas Pluvinage, review by Sadiq Jaffer, Guillaume Munch-Maccagnoni, Enguerrand Decorne, Gabriel Scherer and Anil Madhavapeddy)

  • #11827, #12249: Restore prefetching for GC marking (Fabrice Buoro and Stephen Dolan, review by Gabriel Scherer and Sadiq Jaffer)

  • #11144: Restore frame-pointers support for amd64 (Fabrice Buoro, review by Frederic Bour and KC Sivaramakrishnan)

  • #11935: Load frametables of dynlink'd modules in batch (Stephen Dolan, review by David Allsopp and Guillaume Munch-Maccagnoni)

  • #11284, #12525: Use compression of entries scheme when pruning mark stack. Can decrease memory usage for some workloads, otherwise should be unobservable. (Tom Kelly, review by Sabine Schmaltz, Sadiq Jaffer and Damien Doligez)

  • (breaking change) #11865, #11868, #11876: Clarify that the operations of a custom block must never access the OCaml runtime. The previous documentation only mentioned the main illicit usages. In particular, since OCaml 5.0, it is no longer safe to call caml_remove_global_root or caml_remove_generational_global_root from within the C finalizer of a custom block, or within the finalization function passed to caml_alloc_final. As a workaround, such a finalization operation can be registered with Gc.finalize instead, which guarantees to run the finalizer at a safe point. (Report by Timothy Bourke, discussion by Yotam Barnoy, Timothy Bourke, Sadiq Jaffer, Xavier Leroy, Guillaume Munch-Maccagnoni, and Gabriel Scherer)
  • #12130: Fix multicore crashes with weak hash sets. Fixes #11934. (Nick Barnes, review by François Bobot)

  • #12099: Add ocamlrund option, -events, to produce a trace of debug events during bytecode interpretation. Fixes #12098. (Richard L Ford, review by Gabriel Scherer)

  • #12001: Fix book keeping for last finalisers during the minor cycle (KC Sivaramakrishnan and Enguerrand Decorne, report by Guillaume Bury and Vincent Laviron, review by Sadiq Jaffer and KC Sivaramakrishnan)

  • #11919: New runtime events counters for major heap stats and minor heap resizing. (Sadiq Jaffer, review by Gabriel Scherer and David Allsopp)

  • #11287, #11872, #11955: Clean up reserved header bits (once used for Spacetime profiling). (Nick Barnes, review by Gabriel Scherer and Damien Doligez)

  • #11750: Decouple major slice from minor GC. (KC Sivaramakrishnan, review by Sadiq Jaffer, Guillaume Munch-Maccagnoni and Damien Doligez)

  • #11796: protect lazy computation of code fragment digest by a mutex. This makes the thread sanitizer happier, and avoids duplicating the hashing work. (Gabriel Scherer, review by Xavier Leroy, report by Olivier Nicole)

  • #11137: new Unsafe_store_tag(val, new_tag) macro to stop using Tag_val(val) as lvalue. (Gabriel Scherer, review by Xavier Leroy, Guillaume Munch-Maccagnoni and Nicolás Ojeda Bär)

  • #11880: Restore the correct sigmask in systhreads. (Christiano Haesbaert, review by Guillaume Munch-Maccagnoni and Sébastien Hinderer)

  • #11881: Fix thread-unsafety of registration of operations for "custom" values. (Guillaume Munch-Maccagnoni, review by Gabriel Scherer and KC Sivaramakrishnan)

  • #11980: fix quadratic behavior in natdynlink by using a STW section for frame-descriptor updates. (Gabriel Scherer, review by Sadiq Jaffer, report by André Maroneze for Frama-C and Guillaume Melquiond for Coq)

  • #12121: unrooted implementations of caml_callback*_exn (Gabriel Scherer, review by KC Sivaramakrishnan and Xavier Leroy)

  • #3921, #12039, #12128: poll for signals in long-running polymorphic comparisons. (B. Szilvasy, Gabriel Scherer and Xavier Leroy, review by Stefan Muenzel, Guillaume Munch-Maccagnoni and Damien Doligez)

  • #12231: Support MinGW-w64 11.0 winpthreads library, where the macro to set up to get flexdll working changed (David Allsopp and Samuel Hym, light review by Xavier Leroy)

Language features:

  • (breaking change) #11694: Add short syntax for generative functor types () -> ... (Jeremy Yallop, review by Gabriel Scherer, Nicolás Ojeda Bär, Jacques Garrigue)

  • (breaking change) #11457: Remove old polymorphic variant syntax. With type t = [ `A | `B ], one could use the syntax #t in types, where it means the same thing as [< t], and in patterns, where it means (`A | `B). The use of #t in types for polymorphic variants was deprecated since 2001, and is now removed. The syntax remains available in patterns, or for objects -- when t is a class type. (Stefan Muenzel, review by Gabriel Scherer and Jacques Garrigue)

  • (breaking change) #11984: Add dedicated syntax for generative functor application. Previously, OCaml did not distinguish between F () and F (struct end), even though the latter looks applicative. Instead, the decision between generative and applicative functor application was made based on the type of F. With this patch, we now distinguish these two application forms; writing F (struct end) for a generative functor leads to new warning 73. (Frederic Bour and Richard Eisenberg, review by Florian Angeletti)

  • #9975, #11365: Make empty types (type t = |) immediate. (Antal Spector-Zabusky, review by Gabriel Scherer)

Type system:

  • (breaking change) #6941, #11187, #12483: prohibit using classes through recursive modules inheriting or including a class belonging to a mutually-recursive module would previous behave incorrectly, and now results in a clean error. (Leo White, review by Gabriel Scherer and Florian Angeletti)

  • (breaking change) #12189, #12211: anonymous row variables in explicitly polymorphic type annotation, e.g. 'a. [< X of 'a ] -> 'a, are now implicitly universally quantified (in other words, the example above is now read as 'a 'r. ([< X of 'a ] as 'r) -> 'a). (Florian Angeletti and Gabriel Scherer, review by Jacques Garrigue)

Code generation and optimizations:

  • #11967: Remove traces of Obj.truncate, which allows some mutable loads to become immutable. (Nick Barnes, review by Vincent Laviron and KC Sivaramakrishnan)

  • #9945, #10883: Turn boolean-result float comparisons into primitive operations Uses the architecture's elementary operations for float comparisons, when available, rather than branching and then setting the return value. (Stefan Muenzel, review by Stephen Dolan, Alain Frisch and Vincent Laviron)

  • #8998, #11321, #11430: change mangling of OCaml long identifiers from camlModule__name_NNN to camlModule.name_NNN. The previous mangling schema, using __, was ambiguous. (Xavier Leroy, report by sliquister and Michael Bacarella, review by Gabriel Scherer)

  • #10834: The -safer-matching option disables type-based optimizations of pattern-matching compilation. This allows to produce a match failure if a pattern-matching was wrongly assumed to be exhaustive. Since the exhaustiveness check for GADTs has had bugs in the past, it may be useful if you need extra security with GADTs. (Jacques Garrigue, review by Gabriel Scherer)

  • #11102: Speed up register allocation by permanently spilling registers (Stephen Dolan, review by Xavier Leroy)

  • #11383: Restrict the local function optimisation to forbid moving code inside a sub-function (Vincent Laviron, review by Gabriel Scherer)

  • #11686: Better spilling heuristic for the Linear Scan allocator for more efficient stack usage. (Nicolás Ojeda Bär, Gabriel Scherer, Alain Frisch, review by Gabriel Scherer, Alain Frisch and Nathanaëlle Courant)

  • #11904: Remove arm, i386 native-code backends that were already disabled at configuration time. (Nicolás Ojeda Bär, review by Stephen Dolan, Anil Madhavapeddy, and Xavier Leroy)

  • #11134: Optimise 'include struct' in more cases (Stephen Dolan, review by Leo White and Vincent Laviron)

Other libraries:

  • #11374: Remove pointer cast to a type with stricter alignment requirements in Windows implementation of Unix.gettimeofday. Windows implementations of caml_unix_map_file, caml_unix_lseek and caml_unix_lseek_64 now release the runtime lock. Windows implementation of caml_unix_lockf modernised and simplified. Where possible, 64 bit integers are used instead of LARGE_INTEGER structs. (David Allsopp, review by Jonah Beckford and Xavier Leroy)

  • #11475: Make Unix terminal interface bindings domain-safe (Olivier Nicole and Xavier Leroy, review by Xavier Leroy)

  • #11775: Unix.write on a non-blocking socket under Windows will return normally if the write blocks after some data has already been written (as otherwise there is no way of knowing how much data has been written before blocking). The same behaviour was already present under Unix. (Nicolás Ojeda Bär, review by David Allsopp)

  • (breaking change) #11991: Unix on Windows: map ERROR_TOO_MANY_LINKS to EMLINK. (Nicolás Ojeda Bär)
  • #12067: Document Windows specific meanings of Unix.process_status type (Samuel Hym, review by David Allsopp)

  • #12072: Document and test that Sys.rename works over directories too (Jan Midtgaard, review by Anil Madhavapeddy and Xavier Leroy)

Tools:

  • #11889, #11978: ocamldoc: handle injectivity annotations and wildcards in type parameters. (Florian Angeletti, report by Wiktor Kuchta, review by Jules Aguillon)

  • #11787: Fix GDB scripts to work with OCaml 5's heap layout. (Nick Barnes)

  • #11772: fix ocamlyacc's handling of raw string literals (Demi Marie Obenour)

  • #9290: Add a directive to switch off debugging in toplevel. This allows to see optimized bytecode with -dlambda. (Jacques Garrigue, review by Gabriel Scherer)

  • #11166: ocamllex: the union of two character sets "cset1 | cset2" can now be used in any context where a character set is expected. (Nicolás Ojeda Bär, Martin Jambon, review by Sébastien Hinderer)

  • #11718: ocamlyacc: OCaml-style comments are now supported, in addition to the C-style comments already supported. The syntax is the same as that used in OCaml code. (Demi Marie Obenour, review by Damien Doligez)

  • #11728: ocamlyacc: generate line directives for %type declarations (Demi Marie Obenour, review by Damien Doligez)

  • #11773: ocamlyacc: Do not allow quoted literals (such as 'a' or "bc") in a token name or %type declaration. Previously such literals were accepted by ocamlyacc, but produced malformed OCaml that was rejected by the compiler. (Demi Marie Obenour, review by Gabriel Scherer)

  • #11774: ocamlyacc: fail if there is an I/O error (Demi Marie Obenour, review by Gabriel Scherer)

  • #11973: Add support for postfixed mingw host triplets (Romain Beauxis)

  • #12165: ocamldoc, use standard doctype to avoid quirk mode. (Florian Angeletti, review by Gabriel Scherer)

Manual and documentation:

  • #11476: Add examples in documentation of Hashtbl, Queue, Atomic, Format (Simon Cruanes, review by Yotam Barnoy, Gabriel Scherer, Daniel Bünzli, Ulugbek Abdullaev, and Nicolás Ojeda Bär)

  • #11883, #11884: Update documentation for In_channel and Out_channel with examples and sections to group related functions. (Kiran Gopinathan, review by Daniel Bünzli and Xavier Leroy)

  • #12095, #12097: Put the sample code of the user's manual and reference documentation of the standard library under the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication license.

  • #11892: Document the semantic differences of Unix.exec* between Unix and Windows. (Boris Yakobowski, review by Daniel Bünzli, Gabriel Scherer and Nicolás Ojeda Bär)

  • #9430, #11291: Document the general desugaring rules for binding operators. (Gabriel Scherer, review by Nicolás Ojeda Bär)

  • #11481: Fix the type of Unix.umask to Unix.file_perm -> Unix.file_perm (Favonia, review by Sébastien Hinderer)

  • #11514: Document ocamltest builtin variables and actions (Olivier Nicole, review by Sébastien Hinderer)

  • #11676: Fix missing since annotation in the Sys and Format modules (Github user Bukolab99, review by Florian Angeletti)

  • #12028: Update format documentation to make it clearer that pp_print_newline flushes its newline (Florian Angeletti, review by Gabriel Scherer)

  • #12201: in the tutorial on modules, replace priority queue example by a simpler example based on FIFO queues. (Xavier Leroy, review by Anil Madhavapeddy and Nicolás Ojeda Bär).

  • #12352: Fix a typo in the documentation of Arg.write_arg (Christophe Raffalli, review by Florian Angeletti)

  • #7179, #11894: correct the description of CAMLreturn and CAMLreturn0 in the Interfacing C page and memory.h file. (Dong An, review by Guillaume Munch-Maccagnoni and Olivier Nicole )

Compiler user-interface and warnings:

  • #10647: Show hints for the "undefined global" error in the toplevel (Wiktor Kuchta, review by Gabriel Scherer)

  • #12116: Don't suggest to insert a semicolon when the type is not unit (Jules Aguillon, review by Florian Angeletti)

  • #11679: Improve the error message about too many arguments to a function (Jules Aguillon, review by Gabriel Scherer and Florian Angeletti)

  • #10009: Improve the error reported by mismatched struct/sig and =/: in module and module type bindings. (Jules Aguillon, review by Gabriel Scherer)

  • #11530: Include kinds in kind mismatch error message. "Error: This variant or record definition does not match that of type M.t The original is abstract, but this is a record". (Leonhard Markert, review by Gabriel Scherer and Florian Angeletti)

  • #11646: Add colors to error message hints. (Christiana Anthony, review by Florian Angeletti)

  • #11235, #11864: usage warnings for constructors and fields can now be disabled on field-by-field or constructor-by-constructor basis (Florian Angeletti, review by Gabriel Scherer)

  • #11888: Improve the error message when type variables cannot be deduced from the type parameters: Before: "Error: In this definition, a type variable cannot be deduced from the type parameters." After: "Error: In the GADT constructor T : 'a -> 'a s t the type variable 'a cannot be deduced from the type parameters." (Stefan Muenzel, review by Florian Angeletti and Gabriel Scherer)

  • #10818: Preserve integer literal formatting in type hint. (Leonhard Markert, review by Gabriel Scherer and Florian Angeletti)

  • #11338: Turn some partial application warnings into hints. (Leo White, review by Stephen Dolan)

  • #10931: Improve warning 14 (illegal backslash) with a better explanation of the causes and how to fix it. (David Allsopp, Florian Angeletti, Lucas De Angelis, Gabriel Scherer, review by Nicolás Ojeda Bär, Florian Angeletti, David Allsopp and Gabriel Scherer)

  • #10911: Improve the location reported by parenthesized assert expressions (Fabian Hemmer, review by Gabriel Scherer)

  • #1391, #7645, #3922: Add an early error when compiling different modules with mismatching -for-pack (Pierre Chambart and Vincent Laviron, review by Mark Shinwell)

  • #11297: Report "unclosed" error when "done" is missing in a "do .. done" construct. (Nicolás Ojeda Bär, review by Gabriel Scherer)

  • #11635, #5461, #10564: turn warning 31 (Module_linked_twice) into a hard error for ocamlc — this was already an error with ocamlopt. (Hugo Heuzard, review by Valentin Gatien-Baron and Gabriel Scherer)

  • #11653: Add the -no-absname option to ocamlc, ocamlopt and ocamldep. (Abiola Abdulsalam, review by Sébastien Hinderer and Florian Angeletti)

  • #11696: Add the -no-g option to ocamlc and ocamlopt. (Abiola Abdulsalam, review by Sébastien Hinderer, Nicolás Ojeda Bär and Florian Angeletti)

  • #11722: clearer error messages on non-well-founded type definitions (Gabriel Scherer, review by Jacques Garrigue)

  • #11819: make the native_compiler and native_dynlink configuration variables available through ocamlc -config. (Sébastien Hinderer, review by Gabriel Scherer and David Allsopp)

  • #8602, #11863: Add -stop-after lambda flag option (Douglas Smith and Dmitrii Kosarev, review by Gabriel Scherer)

  • #11910: Simplify naming convention for shadowed or ephemeral identifiers in error messages (eg: Illegal shadowing of included type t/2 by t) (Florian Angeletti, review by Jules Aguillon)

  • #12024: insert a blank line between separate compiler messages (Gabriel Scherer, review by Florian Angeletti, report by David Wong)

  • #12088, #9265, #11949: ocamldebug: fix confusing repeating behavior on blank lines within source scripts (Damien Doligez, review by Gabriel Scherer, report by Gaëtan Gilbert)

  • #12107: use aliases to mark weak row variables: _[< ... ], < _..>, _#ct are now rendered as [< ...] as '_weak1, < .. > as '_weak1, and #ct as '_weak1. (Florian Angeletti, suggestion by Stefan Muenzel, review by Gabriel Scherer)

  • #12051: Improve the error messages when type variables cannot be generalized (Stefan Muenzel, review by Florian Angeletti)

  • (breaking change) #12094: Trigger warning 5 (ignored-partial-application) when the scrutinee of a pattern matching is of arrow type and all cases match wildcard or exception patterns. (Nicolás Ojeda Bär, review by Gabriel Scherer)

Internal/compiler-libs changes:

  • #11018, #11869: Clean up Types.Variance, adding a description of the lattice used, and defining explicitly composition. (Jacques Garrigue, review by Gabriel Scherer and Jeremy Yallop)

  • #11536: Introduce wrapper functions for level management ([Ctype.with_level], etc) and for type variable scoping ([Typetexp.with_local_type_variable_scope]). The older API ([Ctype.(begin_def,end_def)], [Typetexp.(narrow,widen)], etc.) is now removed. (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer)

  • #11601, #11612, #11628, #11613, #11623, #12120 : Clean up some global state handling in emitcode, bytepackager, bytegen, bytesections, spill. (Hugo Heuzard, Stefan Muenzel, review by Vincent Laviron, Gabriel Scherer and Nathanaëlle Courant)

  • #12119, #12188, #12191: mirror type constraints on value binding in the parsetree: the constraint typ in let pat : typ = exp is now directly stored in the value binding node in the parsetree. (Florian Angeletti, review by Richard Eisenberg)

  • #11912: Refactoring handling of scoped type variables (Richard Eisenberg, review by Gabriel Scherer and Florian Angeletti)

  • #11691, #11706: use asm instead of asm for strict ISO C conformance (Xavier Leroy, report by Gregg Reynolds , review by Sadiq Jaffer)

  • #11764: add prototypes to old-style C function definitions and declarations (Antonin Décimo, review by Xavier Leroy)

  • #11693: Remove use of C99 Variable Length Arrays (VLAs) in the runtime. (David Allsopp, review by Xavier Leroy, Guillaume Munch-Maccagnoni, Stefan Muenzel and Gabriel Scherer)

  • #12138: Generalise interface for BUILD_PATH_PREFIX_MAP mapping. Absolute paths are now rewritten too. (Richard L Ford, suggestions and review by Gabriel Scherer)

  • #10512: explain the compilation strategy for switches on constructors (Gabriel Scherer, review by Vincent Laviron)

  • #11990: Improve comments and macros around frame descriptors. (Nick Barnes, review by Gabriel Scherer)

  • #11847, #11849, #11851, #11898: small refactorings in the type checker (Gabriel Scherer, review by Nicolás Ojeda Bär)

  • #11027: Separate typing counter-examples from type_pat into retype_pat; type_pat is no longer in CPS. (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer)

  • #11286, #11515: disambiguate identifiers by using how recently they have been bound in the current environment (Florian Angeletti, review by Gabriel Scherer)

  • #11364: Allow make -C testsuite promote to take TEST and LIST variables (Antal Spector-Zabusky, review by Gabriel Scherer and David Allsopp)

  • #11446: document switch compilation (lambda/switch.ml) (Gabriel Scherer, review by Luc Maranget and Vincent Laviron)

  • #11568: Encode inline record types in Path.t (Leo White and Hyunggyu Jang, review by Gabriel Scherer)

  • #11569: Remove hash type encoding (Hyunggyu Jang, review by Gabriel Scherer and Florian Angeletti)

  • #11627: use return values instead of globals for linear scan intervals (Stefan Muenzel, review by Nicolás Ojeda Bär)

  • #11634: Dll.open_dll now properly handles opening for execution while already opened for checking (Hugo Heuzard, review by Nicolás Ojeda Bär)

  • (breaking change) #11745, #12358: Debugger and toplevels: embed printer types rather than reading their representations from topdirs.cmi at runtime. This change also removes the ocamlmktop initialization module introduced in #11382 which was no longer useful. This change breaks toplevel scripts relying on the visibility of Topdirs in the initial toplevel environment without loading topfind. Since the opam default .ocamlinit file loads topfind, it is expected that only scripts run with ocaml -noinit are affected. For those scripts, accessing Topdirs now requires the compiler-libs directory to be added to the toplevel search path with
      #directory "+compiler-libs";;
    
    as was already the case for the other modules in the toplevel interface library. (Sébastien Hinderer, review by Florian Angeletti, Nicolás Ojeda Bär and Gabriel Scherer)
  • #11615: remove global variables form asmcomp/linearize.ml (Stefan Muenzel, review by Nicolás Ojeda Bär

  • #10856: Add location, attribute(s) visitors to Tast_mapper/Tast_iterator (Yan Dong, review by Nicolás Ojeda Bär and Gabriel Scherer)

  • #11763, #11759, #11861: Enable stricter C compilation warnings, use strict prototypes on primitives. (Antonin Décimo, review by Xavier Leroy, David Allsopp and Sébastien Hinderer)

  • #11933: Use the correct machtype when reading the code pointer from closures (Nathanaëlle Courant, review by Gabriel Scherer and Vincent Laviron)

  • #11972: refactor runtime/frame_descriptors.c in preparation for quadratic-time fix (Gabriel Scherer, review by Enguerrand Decorne)

  • #11997: translate structured constants into their Obj.t representation at compile time rather than link time. Changes the way dumpobj prints these constants because their representation becomes untyped. (Sébastien Hinderer, review by Xavier Leroy, Nicolás Ojeda Bär and Hugo Heuzard)

  • #12011: remove Ctype.reified_var_counter (Takafumi Saikawa and Jacques Garrigue, review by Gabriel Scherer)

  • #12012: move calls to Typetexp.TyVarEnv.reset inside with_local_level etc. (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer)

  • #12034: a logarithmic algorithm to find the next free variable (Gabriel Scherer, review by Stefan Muenzel)

  • #12092: remove Lev_module_definition from lambda (Nick Roberts, review by Gabriel Scherer)

  • #12117: Remove arity-interrupting elaboration of module unpacks (Nick Roberts, review by Richard Eisenberg and Jacques Garrigue)

  • #12118: stop storing names of predefined exceptions in the cu_required_globals field of compilation unit descriptors. (Sébastien Hinderer, review by Vincent Laviron)

  • #12125: Add Misc.print_see_manual and modify [@manual_ref] to accept lists for simpler printing of manual references (Stefan Muenzel, review by Florian Angeletti)

  • #12509: Use strict prototypes on primitives when generating a standalone bytecode executable (ocamlc -custom). (Antonin Décimo, review by Xavier Leroy)

Build system:

  • #11844: Reduce verbosity of make logs by printing program invocations in shorthand (eg OCAMLC foo.cmo). Setting V=1 recovers the old style (with full command-lines). (Xavier Leroy, Nicolás Ojeda Bär, review by Sébastien Hinderer)

  • #11590: Allow installing to a destination path containing spaces. (Élie Brami, review by Sébastien Hinderer and David Allsopp)

  • #11243, #11248, #11268, #11420, #11675: merge the sub-makefiles into the root Makefile. (Sébastien Hinderer, review by David Allsopp and Florian Angeletti)

  • #11828: Compile otherlibs/ C stubs in two version for native and bytecode (Olivier Nicole, review by Sébastien Hinderer and Xavier Leroy)

  • #12265: Stop adding -lexecinfo to cclibs (leftover debugging code from the multicore project). Harden the feature probe for -lm in configure so -lm is only added if strictly necessary. configure.ac now correctly propagates library flags for the Windows ports, allowing Windows OCaml to be configured with ZSTD support. (David Allsopp, review by Sébastien Hinderer)

  • #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3 so that code sections remain readable, as needed for closure marshaling. (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and Sébastien Hinderer)

Bug fixes:

  • #12062: fix runtime events consumer: when events are dropped they shouldn't be parsed. (Lucas Pluvinage)

  • #12132: Fix overcounting of minor collections in GC stats. (Damien Doligez, review by Gabriel Scherer)

  • #12017: Re-register finaliser only after calling user alarm in Gc.create_alarm (Fabrice Buoro, report by Sam Goldman, review by Guillaume Munch-Maccagnoni)

  • #11887, #11893: Code duplication in pattern-matching compilation (Vincent Laviron, report par Greta Yorsh, review by Luc Maranget and Gabriel Scherer)

  • #10664, #11600: Unsoundness in the typing of polymorphic methods involving polymorphic variants (Jacques Garrigue, report by Mike Shulman, review by Gabriel Scherer)

  • #11302, #11412: ocamlc and ocamlopt should not remove generated files when they are not regular files. (Xavier Leroy, report by Thierry Martinez, review by Anil Madhavapeddy, Nicolás Ojeda Bär, David Allsopp)

  • #10348, #10560, #11561: Expand GADT equations lazily during unification to avoid ambiguity (Jacques Garrigue, review by Leo White)

  • #11436: Fix wrong stack backtrace for out-of-bound exceptions raised by leaf functions. (Tom Kelly and Xavier Leroy, review by Mark Shinwell)

  • #11450, #12018: Fix erroneous functor error messages that were too eager to cast struct end functor arguments as unit modules in F(struct end). (Florian Angetti, review by Gabriel Scherer)

  • #11643: Add missing test declaration to float_compare test, so that it will run. (Stefan Muenzel, review by David Allsopp)

  • #11630: Use correct location when reporting record labels with non-existent paths. (Nicolás Ojeda Bär, report by Jason Gross, review by Gabriel Scherer)

  • #11727: Ensure push_defaults can push past module patterns, fixing an currying optimisation accidentally disabled by #10340. (Stephen Dolan, review by Gabriel Scherer)

  • #11771: Use a more relaxed mode for unification in Ctype.subst (Leo White, review by Jacques Garrigue and Gabriel Scherer)

  • #11803, #11808: on x86, the destination of an integer comparison must be a register, it cannot be a stack slot. (Vincent Laviron, review by Xavier Leroy, report by Emilio Jesús Gallego Arias)

  • #11809: Protect Parmatch.pats_of_type from missing cmis (Jacques Garrigue, review by Stephen Dolan and Gabriel Scherer)

  • #11824: Fix a crash when calling ocamlrun -b (Florian Angeletti, review by Sébastien Hinderer)

  • #11815: Marshalling continuations raises invalid argument exception. (Jérôme Vouillon, review by Nicolás Ojeda Bär, Stephen Dolan and Hugo Heuzard)

  • #11846: Mark rbx as destroyed at C call for Win64 (mingw-w64 and Cygwin64). Reserve the shadow store for the ABI in the c_stack_link struct instead of explictly when calling C functions. This simultaneously reduces the number of stack pointer manipulations and also fixes a bug when calling noalloc functions where the shadow store was not being reserved. (David Allsopp, report by Vesa Karvonen, review by Xavier Leroy and KC Sivaramakrishnan)

  • #11850: When stopping before the emit phase (using -stop-after), an empty temporary assembly file is no longer left in the file system. (Nicolás Ojeda Bär, review by Gabriel Scherer and Xavier Leroy)

  • #11866: Fix the result of caml_read_directory() on non-existent paths. (Andrei Paskevich and Charlène Gros, review by David Allsopp and Nicolás Ojeda Bär)

  • #11879: Bugfix for Ctype.nondep_type (Stephen Dolan, review by Gabriel Scherer)

  • #12004: Don't ignore function attributes on lambdas with locally abstract types. (Chris Casinghino, review by Gabriel Scherer)

  • #12037: Fix some data races by using volatile when necessary (Fabrice Buoro and Olivier Nicole, review by Guillaume Munch-Maccagnoni, Gabriel Scherer and Luc Maranget)

  • #12046: Flush stderr when tracing the parser (Hugo Heuzard, review by David Allsopp and Nicolás Ojeda Bär)

  • #12061, #12063: don't add inconsistent equalities when computing high-level error messages for functor applications and inclusions. (Florian Angeletti, review by Gabriel Scherer)

  • #12075: auto-detect whether ar support @FILE arguments at configure-time to avoid using this feature with toolchains that do not support it (eg FreeBSD/Darwin). (Nicolás Ojeda Bär, review by Xavier Leroy, David Allsop, Javier Chávarri, Anil Madhavapeddy)

  • #12103, 12104: fix a concurrency memory-safety bug in Buffer (Gabriel Scherer, review by Florian Angeletti, report by Samuel Hym)

  • #12112: Fix caml_callback{2,3}_exn when used with effect handlers. (Lucas Pluvinage, review by Gabriel Scherer, David Allsopp and Xavier Leroy)

  • #12134: Use ghost location for nodes created when handling defaults in optional arguments. (Paul-Elliot Anglès d'Auriac, review by Gabriel Scherer)

  • #12153: Fix segfault in bytecode programs involving recursive value definitions of values of size 0 (Vincent Laviron, Xavier Leroy, Gabriel Scherer, review by Xavier Leroy, report by Nick Roberts)

  • #12162: Fix miscompilation on amd64 backends involving integer overflows (Vincent Laviron and Greta Yorsh, review by Stefan Muenzel)

  • #12170: fix pthread_geaffinity_np configure check for android (David Allsopp, review by Sébastien Hinderer)

  • #12178: Fix runtime events consumer poll function returning an invalid value instead of an OCaml integer value. (Lucas Pluvinage)

  • #12252: Fix shared library build error on RISC-V. (Edwin Török, review by Nicolás Ojeda Bär and Xavier Leroy)

  • #12255, #12256: Handle large signal numbers correctly (Nick Barnes, review by David Allsopp).

  • #12277: ARM64, fix a potential assembler error for very large functions by emitting stack reallocation code before the body of the function. (Xavier Leroy, review by KC Sivaramakrishnan)

  • #12253, #12342: Fix infinite loop in signal handling. (Guillaume Munch-Maccagnoni, report by Thomas Leonard, review by KC Sivaramakrishnan and Sadiq Jaffer)

  • #12445: missing GC root registrations in runtime/io.c (Gabriel Scherer, review by Xavier Leroy and Jeremy Yallop)

  • #12481, #12505: Fix incorrect initialization of array expressions [|e1;...;eN|] when N is large enough to require major heap allocation. (Xavier Leroy, report by Andrey Popp, analysis by KC Sivaramakrishnan and Vincent Laviron, review by Gabriel Scherer)

  • #11150, #11207, #11936: Avoid recomputation in Typedecl.check_wellfounded (Jacques Garrigue, report by Boris Yakobowski, review by Gabriel Scherer)

  • #11186, #11188: Fix composition of coercions with aliases (Vincent Laviron, report and review by Leo White)

  • #12486: Fix delivery of unhandled effect exceptions on s390x (Miod Vallat, report by Jan Midtgaard, review by Vincent Laviron and Xavier Leroy)

Since last week, there were two significant bugs fixed in the OCaml 5.1.0 runtime (one overflow bug and a stack corruption bug in the s390x port). Since those bug fixes are as small as they are subtle, they were deemed worthy of a release of a third release candidate for OCaml 5.1.0.

If there are no more surprises this week, the release of OCaml 5.1.0 shall happen next week.

If you find any bugs, please report them on OCaml's issue tracker.

The full changelog for OCaml 5.1.0 is available on GitHub

A short summary of the two fixed bugs in this release candidate is also available below.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later:

opam update
opam switch create 5.1.0~rc3

The source code for the release candidate 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.1.0~rc3+options <option_list>

where <option_list> is a comma-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.1.0~rc3+flambda+nffa ocaml-variants.5.1.0~rc3+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Last Second Bug Fixes

  • #11284, +#12525: Use compression of entries scheme when pruning mark stack. Can decrease memory usage for some workloads, otherwise should be unobservable. (Tom Kelly, review by Sabine Schmaltz, Sadiq Jaffer, and Damien Doligez)

  • #12486: Fix delivery of unhandled effect exceptions on s390x (Miod Vallat, report by Jan Midtgaard, review by Vincent Laviron and Xavier Leroy)

In the last two weeks, two significant bugs have been discovered in the release candidate for OCaml 5.1.0 (one affecting the type system, another in the runtime).

Those bugs are now fixed and we are publishing a second release candidate to check that everything is in order before the release in the upcoming week.

If you find any bugs, please report them on OCaml's issue tracker.

The full changelog for OCaml 5.1.0 is available on GitHub. A short summary of the two fixed bugs in this release candidate is also available below.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later:

opam update
opam switch create 5.1.0~rc2

The source code for the release candidate 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.1.0~rc2+options <option_list>

where <option_list> is a comma-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.1.0~rc2+flambda+nffa ocaml-variants.5.1.0~rc2+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Last Minute Bug Fixes

Type System:

  • (breaking change) #6941, #11187, +#12483: prohibit using classes through recursive modules inheriting or including a class belonging to a mutually-recursive module would previous behave incorrectly, and now results in a clean error. (Leo White, review by Gabriel Scherer and Florian Angeletti)

Runtime

  • #12481, #12505: Fix incorrect initialization of array expressions [|e1;...;eN|] when N is large enough to require major heap allocation. (Xavier Leroy, report by Andrey Popp, analysis by KC Sivaramakrishnan and Vincent Laviron, review by Gabriel Scherer)

The release of OCaml 5.1.0 is imminent. As a final step, we are publishing a release candidate to check that everything is in order before the release in the upcoming week(s).

If you find any bugs, please report them on OCaml's issue tracker.

Compared to the beta release, this release contains one safe runtime fix and two configuration tweaks.

The full change log for OCaml 5.1.0 is available on GitHub A short summary of the changes since the beta release is also available below.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later:

opam update
opam switch create 5.1.0~rc1

The source code for the release candidate 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.1.0~rc1+options <option_list>

where <option_list> is a comma-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.1.0~rc1+flambda+nffa ocaml-variants.5.1.0~rc1+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Changes Since the Beta

Bug Fix

  • #12445: missing GC root registrations in runtime/io.c (Gabriel Scherer, review by Xavier Leroy and Jeremy Yallop)

Configuration Fix (openBSD)

  • #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3 so that code sections remain readable, as needed for closure marshaling. (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and Sébastien Hinderer)

Tool Fix (ocamlmktop)

  • #11745, #12358: Debugger and toplevels: embed printer types rather than reading their representations from topdirs.cmi at runtime. This change also removes the ocamlmktop initialisation module introduced in #11382 which was no longer useful. This change breaks toplevel scripts relying on the visibility of Topdirs in the initial toplevel environment without loading topfind. Since the opam default .ocamlinit file loads topfind, it is expected that only scripts run with ocaml -noinit are affected. For those scripts, accessing Topdirs now requires the compiler-libs directory to be added to the toplevel search path with
      #directory "+compiler-libs";;
    

as was already the case for the other modules in the toplevel interface library. (Sébastien Hinderer, review by Florian Angeletti, Nicolás Ojeda Bär, and Gabriel Scherer)

Documentation Changes

  • #12201: in the tutorial on modules, replace priority queue example by a simpler example based on FIFO queues. (Xavier Leroy, review by Anil Madhavapeddy and Nicolás Ojeda Bär).

  • #12352: Fix a typo in the documentation of Arg.write_arg (Christophe Raffalli, review by Florian Angeletti)

After two alpha releases, the release of OCaml 5.1.0 is drawing near. We have thus released a first beta version of OCaml 5.1.0 to help you update your softwares and libraries ahead of the release (see below for the installation instructions). Compared to the last alpha release, this beta contains two subtle internal runtime fixes and one Windows fix. Overall, the opam ecosystem looks in a good shape for the first beta release.

If you find any bugs, please report them on OCaml's issue tracker.

Nearly all core development tools support OCaml 5.1.0, and you can follow the last remaining wrinkles on the opam readiness for 5.1.0 meta-issue.

Currently, the release is planned for the end of July or the beginning of August.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.1.0 is available on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 5.1.0~beta1

The source code for the alpha is also available at these addresses:

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.1.0~beta1+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.1.0~beta1+flambda+nffa ocaml-variants.5.1.0~beta1+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Runtime System Bugfix

  • #12037: Fix some data races by using volatile when necessary (Fabrice Buoro and Olivier Nicole, review by Guillaume Munch-Maccagnoni, Gabriel Scherer and Luc Maranget)

  • #12253, #12342: Fix infinite loop in signal handling. (Guillaume Munch-Maccagnoni, report by Thomas Leonard, review by KC Sivaramakrishnan and Sadiq Jaffer)

Windows Bugfix

  • #12184, #12320: Sys.rename Windows fixes on directory corner cases. (Jan Midtgaard, review by Anil Madhavapeddy)

With the progress of the ongoing stabilisation effort for OCaml 5.1.0, I am happy to announce a second alpha release for OCaml 5.1.0.

This second alpha release contains many noteworthy fixes:

  • a long-awaited GC fix
  • a Windows ABI fix

as announced in the first alpha but also

  • a compiler-libs (parsetree) fix
  • a type system compatibility enhancement change
  • a restored backed for s390x/IBM Z

The full list of changes since the first alpha is available below.

Once most major OCaml tools are updated to the last compiler-libs changes, we will switch to beta releases. Hopefully, this will happen in the upcoming weeks. The progress on stabilising the ecosystem is tracked on the opam readiness for 5.1.0 meta-issue.

Currently, the release is still planned for around July.

If you find any bugs, please report them on OCaml's issue tracker.

If you are interested in the ongoing list of new features and bug fixes, the updated change log for OCaml 5.1.0 is available on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 5.1.0~alpha2

The source code for the alpha is also available at these addresses:

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.1.0~alpha2+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.1.0~alpha2+flambda+nffa ocaml-variants.5.1.0~alpha2+options ocaml-option-flambda ocaml-option-no-flat-float-array

All available options can be listed with opam search ocaml-option.

See full changelog

Runtime System

  • #11589, #11903: Modify the GC pacing code to make sure the GC keeps up with allocations in the presence of idle domains. (Damien Doligez and Stephen Dolan, report by Florian Angeletti, review by KC Sivaramakrishnan and Sadiq Jaffer)
  • (breaking change) #11865, #11868, #11876: Clarify that the operations of a custom block must never access the OCaml runtime. The previous documentation only mentioned the main illicit usages. In particular, since OCaml 5.0, it is no longer safe to call caml_remove_global_root or caml_remove_generational_global_root from within the C finalizer of a custom block, or within the finalization function passed to caml_alloc_final. As a workaround, such a finalization operation can be registered with Gc.finalize instead, which guarantees to run the finalizer at a safe point. (Report by Timothy Bourke, discussion by Yotam Barnoy, Timothy Bourke, Sadiq Jaffer, Xavier Leroy, Guillaume Munch-Maccagnoni, and Gabriel Scherer)
  • #11827, +#12249: Restore prefetching for GC marking (Fabrice Buoro and Stephen Dolan, review by Gabriel Scherer and Sadiq Jaffer)
  • #12131: Simplify implementation of weak hash sets, fixing a performance regression. (Nick Barnes, review by François Bobot, Alain Frisch and Damien Doligez).

  • #12231: Support MinGW-w64 11.0 winpthreads library, where the macro to set up to get flexdll working changed (David Allsopp and Samuel Hym, light review by Xavier Leroy)

Type System

  • (breaking change) #12189, #12211: anonymous row variables in explicitly polymorphic type annotation, e.g. 'a. [< X of 'a ] -> 'a, are now implicitly universally quantified (in other words, the example above is now read as 'a 'r. ([< X of 'a ] as 'r) -> 'a). (Florian Angeletti and Gabriel Scherer, review by Jacques Garrigue)

Code Generation And Optimizations

  • #11712, #12258, #12261: s390x / IBM Z multicore support: OCaml & C stack separation; dynamic stack size checks; fiber and effects support. (Aleksei Nikiforov, with help from Vincent Laviron and Xavier Leroy, additional suggestions by Luc Maranget, review by the same and KC Sivaramakrishnan)

Internal/compiler-libs Changes

  • #12119, +#12188, +#12191: mirror type constraints on value binding in the parsetree: the constraint typ in let pat : typ = exp is now directly stored in the value binding node in the parsetree. (Florian Angeletti, review by Richard Eisenberg)

Bug Fixes

  • #11846: Mark rbx as destroyed at C call for Win64 (mingw-w64 and Cygwin64). Reserve the shadow store for the ABI in the c_stack_link struct instead of explictly when calling C functions. This simultaneously reduces the number of stack pointer manipulations and also fixes a bug when calling noalloc functions where the shadow store was not being reserved. (David Allsopp, report by Vesa Karvonen, review by Xavier Leroy and KC Sivaramakrishnan)

  • #12170: fix pthread_geaffinity_np configure check for android (David Allsopp, review by Sébastien Hinderer)

  • #12252: Fix shared library build error on RISC-V. (Edwin Török, review by Nicolás Ojeda Bär and Xavier Leroy)

  • #12255, #12256: Handle large signal numbers correctly (Nick Barnes, review by David Allsopp).

  • #12277: ARM64, fix a potential assembler error for very large functions by emitting stack reallocation code before the body of the function. (Xavier Leroy, review by KC Sivaramakrishnan)

Four months after the release of OCaml 5.0.0, the set of new features for the future version 5.1.0 of OCaml has been frozen. We are thus happy to announce the first alpha release for OCaml 5.1.0.

This alpha version is here to help fellow hackers join us early in our bug hunting and opam ecosystem fixing fun (see below for the installation instructions). The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.1.0 meta-issue.

If you find any bugs, please report them on OCaml's issue tracker.

Note that this early alpha version is missing two important fixes for the garbage collector and Windows support. Those fixes will be available before the beta. The full release is expected in July.

If you are interested in the ongoing list of new features and bug fixes, the updated change log for OCaml 5.1.0 is available on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 5.1.0~alpha1

For previous version of opam, the switch creation command line is slightly more verbose:

opam update
opam switch create 5.1.0~alpha1 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

The source code for the alpha is also available at these addresses:

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.1.0~alpha1+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.1.0~alpha1+flambda+nffa ocaml-variants.5.1.0~alpha1+options ocaml-option-flambda ocaml-option-no-flat-float-array

The command line above is slightly more complicated for opam version anterior to 2.1:

opam update
opam switch create <switch_name> --packages=ocaml-variants.5.1.0~alpha1+options,<option_list> --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

In both cases, all available options can be listed with opam search ocaml-option.

We have the pleasure of celebrating the birthday of Oronce Finé by announcing the release of OCaml version 4.14.1.

This release is a collection of safe bug fixes, cherry-picked from the OCaml 5.0.0 release. If you were using OCaml 4.14.0 and cannot yet upgrade to OCaml 5, this release is for you.

The 4.14 branch is expected to receive more backported fixes during the maturation of OCaml 5. Thus don't hesitate to report any bugs on the OCaml issue tracker.

See the list of changes below for more details.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands:

opam update
opam switch create 4.14.1

The source code for the release candidate is also directly available on:

See full changelog

Changes in OCaml 4.14.1 (20 December 2022)

Compiler User-Interface and Warnings:

  • #11184, #11670: Stop calling ranlib on created / installed libraries (Sébastien Hinderer and Xavier Leroy, review by the same)

Build System:

  • #11370, #11373: Don't pass CFLAGS to flexlink during configure. (David Allsopp, report by William Hu, review by Xavier Leroy and Sébastien Hinderer)

  • #11487: Thwart FMA test optimisation during configure (William Hu, review by David Allsopp and Sébastien Hinderer)

Bug Fixes:

  • #10768, #11340: Fix typechecking regression when combining first class modules and GADTs. (Jacques Garrigue, report by François Thiré, review by Matthew Ryan)

  • #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when calling virtual methods introduced by constraining the self type from within the class definition. (Nicolás Ojeda Bär, review by Leo White)

  • #11263, #11267: caml/{memory,misc}.h: Check whether _MSC_VER is defined before using it to ensure that the headers can always be used in code which turns on -Wundef (or equivalent). (David Allsopp and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and Sébastien Hinderer)

  • #11314, #11416: Fix non-informative error message for module inclusion (Florian Angeletti, report by Thierry Martinez, review by Gabriel Scherer)

  • #11358, #11379: Refactor the initialisation of bytecode threading, This avoids a "dangling pointer" warning of GCC 12.1. (Xavier Leroy, report by Armaël Guéneau, review by Gabriel Scherer)

  • #11387: Module type with constraints no longer crash the compiler in presence of both shadowing warnings and the -bin-annot compiler flag. (Florian Angeletti, report by Christophe Raffalli, review by Gabriel Scherer)

  • #11392, #11392: Assertion failure with -rectypes and external definitions (Gabriel Scherer, review by Florian Angeletti, report by Dmitrii Kosarev)

  • #11417: Fix a regression which allowed virtual methods in non-virtual classes. (Leo White, review by Florian Angeletti)

  • #11468: Fix regression from #10186 (OCaml 4.13) detecting IPv6 on Windows for Mingw-w64 i686 port. (David Allsopp, review by Xavier Leroy and Sébastien Hinderer)

  • #11489, #11496: More prudent deallocation of alternate signal stack (Xavier Leroy, report by @rajdakin, review by Florian Angeletti)

  • #11516, #11524: Fix the deprecated_mutable attribute. (Chris Casinghino, review by Nicolás Ojeda Bär and Florian Angeletti)

  • #11194, #11609: Fix inconsistent type variable names in "unbound type var" messages (Ulysse Gérard and Florian Angeletti, review Florian Angeletti and Gabriel Scherer)

  • #11622: Prevent stack overflow when printing a constructor or record mismatch error involving recursive types. (Florian Angeletti, review by Gabriel Scherer)

  • #11732: Ensure that types from packed modules are always generalised (Stephen Dolan and Leo White, review by Jacques Garrigue)

  • #11737: Fix segfault condition in Unix.stat under Windows in the presence of multiple threads. (Marc Lasson, Nicolás Ojeda Bär, review by Gabriel Scherer and David Allsopp)

  • #11776: Extend environment with functor parameters in strengthen_lazy. (Chris Casinghino and Luke Maurer, review by Gabriel Scherer)

  • #11533, #11534: Follow synonyms again in #show_module_type (this had stopped working in 4.14.0) (Gabriel Scherer, review by Jacques Garrigue, report by Yaron Minsky)

  • #11768, #11788: Fix crash at start-up of bytecode programs in no-naked-pointers mode caused by wrong initialisation of caml_global_data (Xavier Leroy, report by Etienne Millon, review by Gabriel Scherer)

  • #11803, #11808: On x86, the destination of an integer comparison must be a register; it cannot be a stack slot. (Vincent Laviron, review by Xavier Leroy, report by Emilio Jesús Gallego Arias)

We have the pleasure of celebrating the birthdays of Jane Austen and Arthur C. Clarke by announcing the release of OCaml version 5.0.0.

The highlight of this new major version of OCaml is the long-awaited runtime support for shared memory parallelism and effect handlers.

This multicore support is the culmination of more than 8 years of effort, and required a full rewrite of the OCaml runtime environment. Consequently, OCaml 5.0.0 is expected to be a more experimental version of OCaml than the usual OCaml releases.

In this release, the native compiler only supports the x86-64 and arm64 architectures. In terms of operating systems, Linux, the BSDs, macOS and mingw64 on Windows are supported.

We are planning to restore the support for most previously supported architectures and operating systems, and address remaining known issues over the course of the next year.

Don't let those words of caution hinder your experimentation with OCaml 5: OCaml 5 as a language is fully compatible with OCaml 4 down to the performance characteristics of your programs. In other words, any code that works with OCaml 4 should work the same with OCaml 5.

The currently known exceptions to this rule are:

  • the removal of many long-deprecated functions and modules
  • changes to the internal runtime API
  • the performance of ephemerons is currently (and temporarily) strongly degraded.

Please report any unexpected behaviours on the OCaml issue tracker and post any questions or comments you might have on our discussion forums.

During the maturing period for OCaml 5, the OCaml 4.14 branch will be maintained by backporting bug fixes from the OCaml 5 branch at regular intervals. The next release on the OCaml 4.14 branch, OCaml 4.14.1, should soon follow this release.

The full list of changes can be found in the changelog below.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands:

opam update
opam switch create 5.0.0

It might be also interesting to check the new support for parallelism by installing the domainslib library with

opam install domainslib

The source code for the release candidate 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.0.0+options <option_list>

where <option_list> is a comma-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.0.0+flambda+nffa ocaml-variants.5.0.0+options ocaml-option-flambda ocaml-option-no-flat-float-array

The command line above is slightly more complicated for opam versions before 2.1:

opam update
opam switch create <switch_name> --packages=ocaml-variants.5.0.0+options,<option_list>

In both cases, all available options can be listed with opam search ocaml-option.

See full changelog

OCaml 5.0.0 (16 December 2022)

  • #10831: Multicore OCaml (Enguerrand Decorne, Stephen Dolan, Tom Kelly, Sadiq Jaffer, Anil Madhavapeddy, Sudha Parimala, KC Sivaramakrishnan, Leo White, the Tarides multicore team, review by Florian Angeletti, Damien Doligez, Xavier Leroy, Guillaume Munch-Maccagnoni, Olivier Nicole, Nicolás Ojeda Bär, Gabriel Scherer, the OCaml core development team, and many other valued reviewers.)

Runtime system:

  • #11400: Runtime events counters fixes Fixes mismatch between OCaml and C APIs, removes events from 4.x that are not present in the 5.0 GC and adds some missing probes. (Sadiq Jaffer, review by Gabriel Scherer, Florian Angeletti)

  • #11368: Runtime events buffer size OCAMLRUNPARAMS fix The runtime events buffer size can now be set via the 'e' OCAMLRUNPARAM. This is previously mistakenly enabled/disabled tracing instead. (Sadiq Jaffer, review by KC Sivaramakrishnan, David Allsopp, Damien Doligez)

  • #11308: Add environment variable to preserve runtime_events after exit If the environment variable OCAML_RUNTIME_EVENTS_PRESERVE exists then the runtime will not remove the runtime events ring buffers at exit. This makes tracing very short running programs more reliable. (Sadiq Jaffer, review by KC Sivaramakrishnan)

  • #10964: Ring-buffer based runtime tracing (runtime_events) Runtime_events is a very low overhead runtime tracing system designed for continuous monitoring of OCaml applications. (Sadiq Jaffer, review by Anil Madhavapeddy, Enguerrand Decorne, Richard Warburton, Gabriel Scherer, Sabine Schmaltz, Florian Angeletti, Patrick Ferris, Tom Kelly)

  • (breaking change) #10723: do not use -flat-namespace linking for macOS. (Carlo Cabrera, review by Damien Doligez)

  • (breaking change) #10863, #10933: Remove support for old, unprefixed C runtime function names such as alloc. The new names prefixed with caml_ must be used instead, such as caml_alloc. Consequently, it is no longer needed to define CAML_NAME_SPACE to avoid bringing unprefixed names into scope: this is now the default behavior. (Nicolás Ojeda Bär, review by Xavier Leroy)

  • #10902: Do not register empty code fragments in natdynlink. (David Allsopp, review by Xavier Leroy and Damien Doligez)

  • #10965: caml_fatal_error_hook, GC timing hooks, and caml_scan_roots_hook are now atomic variables. Restore GC timing hooks in multicore. (Guillaume Munch-Maccagnoni, review by Enguerrand Decorne, Xavier Leroy, Gabriel Scherer, and KC Sivaramakrishnan)

  • #11209: Add a public and thread-safe timing hook running at domain termination, after this domain has stopped running any OCaml code: caml_domain_terminated_hook. This can be useful for implementing domain-local state in C. (Guillaume Munch-Maccagnoni, review by Xavier Leroy and Gabriel Scherer)

  • #10875, #11731: Add option to allocate fiber stacks and sigaltstacks with mmap(MAP_STACK) instead of malloc. This is exposed via a configure --enable-mmap-map-stack option, and is enabled by default on OpenBSD where it is mandatory. (Anil Madhavapeddy, review by Gabriel Scherer, Tom Kelly, Michael Hendricks and KC Sivaramakrishnan).

  • #10950: Do not use mmap to allocate Caml_state. In order to reduce virtual memory usage, we dynamically allocate the domain_state structure. (Enguerrand Decorne, KC Sivaramakrishnan and Tom Kelly, review by Anil Madhavapeddy and Gabriel Scherer)

  • #11010: Use strerror_r for reentrant error string conversion. (Anil Madhavapeddy and Xavier Leroy, review by same and Edwin Török)

  • #11002, #11066, #11086: Do not use Begin_roots/End_roots macros in the runtime system. Also fix a missing root registration in the implementation of Unix.write on Windows. (Nicolás Ojeda Bär, Daniel Bünzli and Antonin Décimo, review by Xavier Leroy and David Allsopp)

  • #11022: Track GC work for all managed bigarray allocations (Stephen Dolan, report by Andrew Hunter, review by Damien Doligez)

  • #10802: Use 4.12 value macros and helpers in C code (Antonin Décimo, review by Gabriel Scherer)

  • #11105: Fix handling of fiber stack cache with multiple domains (Jon Ludlam, KC Sivaramakrishnan and Tom Kelly)

  • #11054: Respect user provided maximum stack space Make sure the stack we initially request is sized accordingly to the user provided settings. tmc/stack_space is also updated by this PR in order to account for this change. (Enguerrand Decorne, report by Jon Ludlam, review by Tom Kelly, KC Sivaramakrishnan and Gabriel Scherer)

  • #11238: Increase the default limit for the stack size to 128 Mi words, i.e. 1 Gib for 64-bit platforms and 512 Mib for 32-bit platforms. (Xavier Leroy, review by Sébastien Hinderer)

  • (breaking change) #11295: An ISO C 2011 compliant compiler, including full support for atomic types, is now required to build the OCaml runtime system. (Xavier Leroy, review by David Allsopp and Sébastien Hinderer)
  • #10915, #11039, #11057, #11095, #11190: Implement quality treatment for asynchronous actions in multicore. Reimplement the old behaviour of caml_process_pending* for multicore. (Guillaume Munch-Maccagnoni, review by Sadiq Jaffer and Gabriel Scherer)

  • #11303: Ensure that GC is not invoked from bounds check failures (Stephen Dolan, review by Sadiq Jaffer and Xavier Leroy)

  • #11304: Fix data race on Windows file descriptors (Olivier Nicole and Xavier Leroy, review by Xavier Leroy, David Allsopp, and Sadiq Jaffer)

  • (breaking change) #11337: pass 'flags' metadata to root scanners, to optimize stack scanning in the bytecode interpreter. Changes the interface of user-provided root-scanning hooks. (Gabriel Scherer, review by Xavier Leroy, Guillaume Munch-Maccagnoni, Sadiq Jaffer and Tom Kelly)
  • #11144: Restore frame-pointers support for amd64 (Fabrice Buoro, review by Frederic Bour and KC Sivaramakrishnan)
  • (breaking change) #11255: in the C interface, &Field(v, i) now has type volatile value * instead of value * in OCaml 4. This makes the memory model for mixed OCaml/C code better defined, but can cause warnings or type errors in user C code. (KC Sivaramakrishnan, review by Xavier Leroy, Gabriel Scherer and Guillaume Munch-Maccagnoni, additional discussions with Stephen Dolan and Luc Maranget)
  • #5299, #4787, #11138, #11272, #11506: To help debugging, Caml_state now dynamically checks that the domain lock is held, and fails otherwise (with a fatal error at most entry points of the C API, or systematically in debug mode). A new variable Caml_state_opt is introduced, and is NULL when the domain lock is not held. This allows to test from C code if the current thread holds the lock of its domain. (Guillaume Munch-Maccagnoni, review by Florian Angeletti, Damien Doligez, Sadiq Jaffer, Xavier Leroy, and Gabriel Scherer)

  • #11223: The serialization format of custom blocks changed in 4.08, but the deserializer would still support the pre-4.08 format. OCaml 5.x removed support for this old format; provide a clear error message in this case. (Hugo Heuzard, review by Gabriel Scherer)

  • #11504, #11522: Use static allocation in caml_make_float_vect in no-flat-float-array mode, it's more efficient and avoids a a race condition (Xavier Leroy, report by Guillaume Munch-Maccagnoni, review by David Allsopp)

  • #11652: Fix benign off-by-one error in Windows implementation of caml_mem_map. (David Allsopp, review by Gabriel Scherer)

  • #11669, #11704: Fix construction of Effect.Unhandled exceptions in the bytecode interpreter. (David Allsopp and Xavier Leroy, report by Samuel Hym, review by Xavier Leroy and Gabriel Scherer)

Code generation and optimizations:

  • #10972: ARM64 multicore support: OCaml & C stack separation; dynamic stack size checks; fiber and effects support. (Tom Kelly and Xavier Leroy, review by KC Sivaramakrishnan, Xavier Leroy Guillaume Munch-Maccagnoni, Eduardo Rafael, Stephen Dolan and Gabriel Scherer)
  • (breaking change) #10845 Emit frametable size on amd64 BSD (OpenBSD, FreeBSD, NetBSD) systems (emitted for Linux in #8805) (Hannes Mehnert, review by Nicolás Ojeda Bär)

Standard library:

  • #10742: Use LXM as the pseudo-random number generator for module Random. Add Random.State.split and Random.split to "split" a PRNG off another PRNG. (Xavier Leroy, review by Gabriel Scherer and Hugo Heuzard)
  • (breaking change) #10867, #11345: Remove deprecated values: Array.create, Array.make_float, Array.create_matrix, Bytes.uppercase, Bytes.lowercase, Bytes.capitalize, Bytes.uncapitalize, Char.lowercase, Char.uppercase, Filename.temp_dir_name, Int32.format, Int64.format, Nativeint.format, Format.bprintf, Format.kprintf, Format.set_all_formatter_output_functions, Format.get_all_formatter_output_functions, Format.pp_set_all_formatter_output_functions, Format.pp_get_all_formatter_output_functions, Format.pp_open_tag, Format.pp_close_tag, Format.open_tag, Format.close_tag, Format.formatter_tag_functions, Format.pp_set_formatter_tag_functions, Format.pp_get_formatter_tag_functions, Format.set_formatter_tag_functions, Format.get_formatter_tag_functions, Gc (mutability of the fields of type Gc.control), Lazy.lazy_from_fun, Lazy.lazy_from_val, Lazy.lazy_is_val, Obj.set_tag, Obj.truncate, Obj.final_tag, Obj.extension_constructor, Obj.extension_name, Obj.extension_id, Scanf.stdib, Scanf.fscanf, Scanf.kfscanf, Stdlib.( & ), Stdlib.( or ), String.set, String.copy, String.fill, String.unsafe_set, String.unsafe_fill, String.uppercase, String.lowercase, String.capitalize, String.uncapitalize, Thread.kill, Thread.wait_write, Thread.wait_read, the whole ThreadUnix module, the infix operator (.[]<-). (Nicolás Ojeda Bär, review by Damien Doligez)

  • (breaking change) #10896: Remove Stream, Genlex and Pervasives. Also remove legacy standalone bigarray library (the Bigarray module is now part of the standard library). (Nicolás Ojeda Bär, review by Kate Deplaix and Anil Madhavapeddy)

  • #10921: Use getentropy, when available, to seed the generator during Random.self_init (Michael Hendricks, review by Gabriel Scherer, Xavier Leroy, and Anil Madhavapeddy)
  • (breaking change) #10924: Add deprecated attribute to Printexc.catch, Printf.kprintf and Unix.SO_ERROR. (Nicolás Ojeda Bär, review by Damien Doligez)
  • #10986: Add Scanf.sscanf_opt, Scanf.bscanf_opt and Scanf.scanf_opt. (Nicolás Ojeda Bär, review by Florian Angeletti and Gabriel Scherer)
  • (breaking change) #11157: Rename "hash" in the "Hashtbl.SeededHashedType" signature to "seeded_hash". This allows defining both seeded and unseeded hash functions in the same module. (Nicolás Ojeda Bär, review by Gabriel Scherer and Xavier Leroy)
  • #8878: Add String.hash and String.seeded_hash. (Tom Kelly, review by Alain Frisch and Nicolás Ojeda Bär)

Other libraries:

  • (breaking change) #9071, #9100, #10935: Reimplement Thread.exit() as raising the exception Thread.Exit, and mark Thread.exit as deprecated. The new implementation changes the behavior compared with the OCaml 4 implementation. For example, the new implementation causes Fun.finally finalizers to be run and catch-all exception handlers to prevent termination. (Jacques-Henri Jourdan and Xavier Leroy, review by Damien Doligez, Guillaume Munch-Maccagnoni, Gabriel Scherer, and Enguerrand Decorne)
  • #11034: Dynlink library, add a global lock to make dynlinking thread-safe. (Florian Angeletti, review by Gabriel Scherer)

  • #11087: deprecate Thread.wait_timed_read, Thread.wait_timed_write, Thread.select, Thread.wait_pid. The same functionality is available in the Unix module. (Nicolás Ojeda Bär, review by Anil Madhavapeddy)

  • #11309, #11424, #11427, #11545: Add Domain.recommended_domain_count. (Christiano Haesbaert, Konstantin Belousov, review by David Allsopp, KC Sivaramakrishnan, Gabriel Scherer, Nicolas Ojeda Bar)

  • #11461, #11466: Fix gethostbyaddr for IPv6 arguments and make it domain-safe (Olivier Nicole, Nicolás Ojeda Bär, David Allsopp and Xavier Leroy, review by the same)

  • #11479: Make Unix.symlink domain-safe on Windows (Olivier Nicole, review by Xavier Leroy and David Allsopp)

Tools:

  • (breaking change) #11004: Litmus tests for checking the implementation of the memory model. (Luc Maranget, review by Gabriel Scherer and Xavier Leroy)
  • #11024: Handle alerts in ocamldoc. The alert [@@alert deprecated] is handled specifically and it's no longer needed to duplicate the deprecated annotation (the alert for the compiler and the tag for the documentation). Every other alerts also appear in the documentation. (Jules Aguillon, review by Florian Angeletti)

  • #11065: Port the bytecode debugger to 5.0, adding support for effect handlers. (Damien Doligez and @fabbing, review by @fabbing and Xavier Leroy)

  • #11079: Add the -nobanners option to dumpobj. (Sébastien Hinderer, review by Gabriel Scherer and Vincent Laviron)

  • #11100: Fix ocamltest to make sure failed tests are not counted as "unexpected error". (Damien Doligez, review by Sébastien Hinderer)

  • #11245: Merge the common code of ocamlcp and ocamloptp into a single module. (David Allsopp, review by Sébastien Hinderer)

  • #11382: OCamlmktop use a new initialization module "OCamlmktop_init" to preserve backward-compatibility with user-module provided modules that install toplevel printers. (Florian Angeletti, review by Gabriel Scherer and David Allsopp)

Manual and documentation:

  • #11058: runtime/HACKING.adoc tips on debugging the runtime (Gabriel Scherer, review by Enguerrand Decorne and Nicolás Ojeda Bär)

  • #11093: Add an effect handlers tutorial (KC Sivaramakrishnan, review by François Pottier, Gabriel Scherer, François Bobot and Wiktor Kuchta)

  • #11192: Better documentation for condition variables. (François Pottier, review by Luc Maranget, Xavier Leroy, and Wiktor Kuchta)

  • #11093: Add tutorials on parallelism features and the relaxed memory model (KC Sivaramakrishnan, review by Damien Doligez, Anil Madhavapeddy, Gabriel Scherer, Thomas Leonard, Tom Ridge, Xavier Leroy, Luc Maranget, Fabrice Buoro, Olivier Nicole, Guillaume Munch-Maccagnoni, Jacques-Henri Jourdan)

  • #11640: Add Flambda commonly-used options to the ocamlopt manpage (Amandine Nangah, review by David Allsopp, Florian Angeletti, Sébastien Hinderer, and Vincent Laviron)

  • #11676: Fix missing since annotation in the Sys and Format modules (Github user Bukolab99, review by Florian Angeletti)

  • #11813: Make new multicore chapters easier to discover, and emphasize impact on C bindings. (Edwin Török, review by KC Sivaramakrishnan, and Florian Angeletti)

Compiler user-interface and warnings:

  • #9140, #11131: New command-line flag -nocwd to not include implicit the current directory to the load path. (Thomas Roglin, review by Gabriel Scherer and Nicolás Ojeda Bär)

  • #11089: Add 'since ' information to compiler warnings. (André Maroneze, review by Florian Angeletti and Gabriel Scherer)

  • #10909: Disable warning 59 (assignment to immutable blocks) unless flambda invariant checks are enabled. (Vincent Laviron, review by Gabriel Scherer)

  • #10981, #11276: Implement a -cmi-file option for ocamlc and ocamlopt. (Sébastien Hinderer, review by Damien Doligez, Daniel Bünzli and Florian Angeletti)

  • (breaking change) #11049: Stop padding 1-digit compiler minor version numbers. (So for instance OCaml 5.0 rather than 5.00) (Sébastien Hinderer, review by David Allsopp, Florian Angeletti and Xavier Leroy)
  • #11184, #11670: Stop calling ranlib on created / installed libraries (Sébastien Hinderer and Xavier Leroy, review by the same)

  • #11253: Deprecate ocaml script and ocamlnat script where script has no extension and is an implicit basename. (David Allsopp, review by Florian Angeletti and Sébastien Hinderer)

Internal/compiler-libs changes:

  • #10878, #10909: restore flambda after the Multicore merge. (Vincent Laviron, review by Gabriel Scherer and Xavier Leroy)

  • #10864, #10888: restore afl-fuzz mode for sequential programs. (Jan Midtgaard, review by Xavier Leroy and Gabriel Scherer)

  • #11008, #11047: rework GC statistics in the Multicore runtime (Gabriel Scherer, review by Enguerrand Decorne)

  • #11058: basic debugging documentation in runtime/HACKING.adoc (Gabriel Scherer, review by Enguerrand Decorne and Nicolás Ojeda Bär)

  • #11199: Stop installing topdirs.cmi twice. The toplevel now reads topdirs.cmi from +compiler-libs, as the debugger does. (David Allsopp, review by Sébastien Hinderer)

  • #11007, #11399: META files for the stdlib, compiler-libs and other libraries (unix, dynlink, str, runtime_events, threads, ocamldoc) are now installed along with the compiler. (David Allsopp, Florian Angeletti, Nicolás Ojeda Bär and Sébastien Hinderer, review by Daniel Bünzli, Kate Deplaix, Anil Madhavapeddy and Gabriel Scherer)

Build system:

  • (breaking change) #10893: Remove configuration options --disable-force-safe-string and DEFAULT_STRING=unsafe as well as --enable-force-safe-string and DEFAULT_STRING=safe which are now the default unconditionally. (Kate Deplaix, review by Gabriel Scherer and David Allsopp)
  • #11092: Build native-code compilers on OpenBSD/aarch64. (Christopher Zimmermann, review by Anil Madhavapeddy)

  • #11126: Build system: make it possible to choose which ocamldep (and flags) to use when computing dependencies for the compiler. Add a -no-slash option to ocamldep to let users override -slash. (Sébastien Hinderer, review by David Allsopp)

  • #11147: Factorize the stdlib-related compilation flags. Make it possible to control them consistently through the STDLIBFLAGS build variable. Make sure ocamldoc and ocamllex get compiled and linked with debugging information (-g). (Sébastien Hinderer, review by Gabriel Scherer)

  • #11149: Make the bootstrap process reproducible on systems with non-big-endian floating point. If the boot/ artefacts are up-to-date, this means that running make bootstrap on any platform should not change the images in boot/ and paves the way for automated testing that the bootstrap is repeatable. (David Allsopp, review by Damien Doligez and Sébastien Hinderer)

  • #11160: otherlibs: merge win32unix into unix. (Sébastien Hinderer, review by David Allsopp, Nicolás Ojeda Bär, Xavier Leroy, Vincent Laviron and Antonin Décimo)

  • (breaking change) #11198, #11298: Install the Dynlink, Str and Unix libraries to individual subdirectories of LIBDIR. The compiler, debugger and toplevel automatically add -I +lib if required, but display an alert. (David Allsopp, review by Florian Angeletti, Nicolás Ojeda Bär, Valentin Gatien-Baron and Sébastien Hinderer)
  • #11200: Install ocamlprof's Profiling runtime module to a +profiling, removing it from the default namespace. (David Allsopp, review by Sébastien Hinderer)

  • #11294: Switch minimum required autoconf to 2.71. (David Allsopp, review by Xavier Leroy)

  • #11370, #11373: Don't pass CFLAGS to flexlink during configure. (David Allsopp, report by William Hu, review by Xavier Leroy and Sébastien Hinderer)

  • #11487: Thwart FMA test optimization during configure (William Hu, review by David Allsopp and Sébastien Hinderer)

  • #11097: Build native-code compilers on NetBSD/aarch64 (Kate Deplaix, review by Anil Madhavapeddy)

Bug fixes:

  • #10768, #11340: Fix typechecking regression when combining first class modules and GADTs. (Jacques Garrigue, report by François Thiré, review by Matthew Ryan)

  • #10790: don't drop variance and injectivity annotations when pretty printing with constraints (for example, with type +!'a t = ...). (Florian Angeletti, report by Luke Maurer, review by Matthew Ryan and Gabriel Scherer)

  • #11167: Fix memory leak from signal stack. (Antoni Żewierżejew, review by Gabriel Scherer and Enguerrand Decorne)

  • #11112: harden -use-runtime against spaces or quotes in the provided path (Gabriel Scherer, report by Brahima Dibassi, review by David Allsopp)

  • #11068, #11070: Fix typo in function name given in Unix_error exception for Unix.readlink on Windows. (David Allsopp, report by Xia Li-yao)

  • #10807: Don't duplicate standard handles in the child process spawned by win32unix Unix.create_process if the handles were already inheritable. Fix broken signalling of EOF on standard handles if they were already inheritable. (Antonin Décimo, review by Xavier Leroy and Nicolás Ojeda Bär)

  • #10868: Fix off-by-1 bug when initializing frame hashtables (Jonah Beckford, review by Tom Kelly, Nicolás Ojeda Bär and KC Sivaramakrishnan)

  • #11077: Make dumpobj compatible with absence of naked pointer support (Olivier Nicole and Jan Midtgaard, review by Gabriel Scherer)

  • #11111: fix fork() usage in ocamltest C code. When calling fork() from C code with the Multicore runtime active, one needs to call caml_atfork_hook() on the forked child before it can use the OCaml runtime. (Gabriel Scherer, review by Xavier Leroy, report by Brahima Dibassi)

  • #10809: Use the WSA_FLAG_NO_HANDLE_INHERIT on Windows when creating sockets with WSASocket if the cloexec (non-inheritable) parameter is true. Fixes a race condition where a child process could inherit the socket and deadlock the parent. (Antonin Décimo, review by Xavier Leroy)

  • #11194, #11609: Fix inconsistent type variable names in "unbound type var" messages (Ulysse Gérard and Florian Angeletti, review Florian Angeletti and Gabriel Scherer)

  • #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when calling virtual methods introduced by constraining the self type from within the class definition. (Nicolás Ojeda Bär, review by Leo White)

  • #11263, #11267: caml/misc.h: check whether _MSC_VER is defined before using it to ensure that the headers can always be used in code which turns on -Wundef (or equivalent). (David Allsopp and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and Sébastien Hinderer)

  • #11289, #11405: fix some leaks on systhread termination (Fabrice Buoro, Enguerrand Decorne, Gabriel Scherer, review by Xavier Leroy and Florian Angeletti, report by Romain Beauxis)

  • #11314, #11416: fix non-informative error message for module inclusion (Florian Angeletti, report by Thierry Martinez, review by Gabriel Scherer)

  • #11358, #11379: Refactor the initialization of bytecode threading, This avoids a "dangling pointer" warning of GCC 12.1. (Xavier Leroy, report by Armaël Guéneau, review by Gabriel Scherer)

  • #11387, module type with constraints no longer crash the compiler in presence of both shadowing warnings and the -bin-annot compiler flag. (Florian Angeletti, report by Christophe Raffalli, review by Gabriel Scherer)

  • #11392, #11392: assertion failure with -rectypes and external definitions (Gabriel Scherer, review by Florian Angeletti, report by Dmitrii Kosarev)

  • #11417: Fix regression allowing virtual methods in non-virtual classes. (Leo White, review by Florian Angeletti)

  • #11468: Fix regression from #10186 (OCaml 4.13) detecting IPv6 on Windows for mingw-w64 i686 port. (David Allsopp, review by Xavier Leroy and Sébastien Hinderer)

  • #11482, #11542: Fix random crash in large closure allocation (Damien Doligez, report by Thierry Martinez and Vincent Laviron, review by Xavier Leroy)

  • #11508, #11509: make Bytes.escaped domain-safe (Christiano Haesbaert and Gabriel Scherer, review by Xavier Leroy, report by Jan Midtgaard and Tom Kelly)

  • #11516, #11524: Fix the deprecated_mutable attribute. (Chris Casinghino, review by Nicolás Ojeda Bär and Florian Angeletti)

  • #11576: Fix bug in Bigarray.Genarray.init in the the case of zero-dimensional arrays. (Nicolás Ojeda Bär, Jeremy Yallop, report by Masayuki Takeda, review by Jeremy Yallop and Florian Angeletti)

  • #11587: Prevent integer comparison from being used on pointers (Vincent Laviron, review by Gabriel Scherer)

  • #11622: Prevent stack overflow when printing a constructor or record mismatch error involving recursive types. (Florian Angeletti, review by Gabriel Scherer)

  • #11662, #11673: fix a memory leak when using Dynlink, the bug was only present in development version of OCaml 5. (Stephen Dolan, report by Andre Maroneze, review by Gabriel Scherer)

  • #11732: Ensure that types from packed modules are always generalised (Stephen Dolan and Leo White, review by Jacques Garrigue)

  • #11737: Fix segfault condition in Unix.stat under Windows in the presence of multiple threads. (Marc Lasson, Nicolás Ojeda Bär, review by Gabriel Scherer and David Allsopp)

  • #11776: Extend environment with functor parameters in strengthen_lazy. (Chris Casinghino and Luke Maurer, review by Gabriel Scherer)

  • #11533, #11534: follow synonyms again in #show_module_type (this had stopped working in 4.14.0) (Gabriel Scherer, review by Jacques Garrigue, report by Yaron Minsky)

The release of OCaml version 4.14.1 is imminent.

This companion release to the OCaml 5.0.0 release will backport many safe bug fixes from the currently experimental 5.0 branch to the stable 4.14 branch. A full list of bug fixes is available below.

In order to ensure that the future release works as expected, we are testing a release candidate during the upcoming weeks.

If you find any bugs, please report them here on GitHub.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 4.14.1~rc1

For previous version of opam, the switch creation command line is slightly more verbose:

opam update
opam switch create 4.14.1~rc1 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

It might be also interesting to check the new support for parallelism by installing the domainslib library with

opam install domainslib

The source code for the release candidate is 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.4.14.1~rc1+options <option_list>

where <option_list> is a comma-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 4.14.1~rc1+flambda+nffa ocaml-variants.4.14.1~rc1+options ocaml-option-flambda ocaml-option-no-flat-float-array

The command line above is slightly more complicated for opam versions before 2.1:

opam update
opam switch create <switch_name> --packages=ocaml-variants.4.14.1~rc1+options,<option_list> --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

In both cases, all available options can be listed with opam search ocaml-option.

See full changelog

Changes Since OCaml 4.14.0

Compiler User-Interface and Warnings:

  • #11184, #11670: Stop calling ranlib on created / installed libraries (Sébastien Hinderer and Xavier Leroy, review by the same)

Build System:

  • #11370, #11373: Don't pass CFLAGS to flexlink during configure. (David Allsopp, report by William Hu, review by Xavier Leroy and Sébastien Hinderer)

  • #11487: Thwart FMA test optimisation during configure (William Hu, review by David Allsopp and Sébastien Hinderer)

Bug Fixes:

  • #10768, #11340: Fix typechecking regression when combining first class modules and GADTs. (Jacques Garrigue, report by François Thiré, review by Matthew Ryan)

  • #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when calling virtual methods introduced by constraining the self type from within the class definition. (Nicolás Ojeda Bär, review by Leo White)

  • #11263, #11267: caml/{memory,misc}.h: check whether _MSC_VER is defined before using it to ensure that the headers can always be used in code which turns on -Wundef (or equivalent). (David Allsopp and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and Sébastien Hinderer)

  • #11314, #11416: fix non-informative error message for module inclusion (Florian Angeletti, report by Thierry Martinez, review by Gabriel Scherer)

  • #11358, #11379: Refactor the initialisation of bytecode threading, This avoids a "dangling pointer" warning of GCC 12.1. (Xavier Leroy, report by Armaël Guéneau, review by Gabriel Scherer)

  • #11387, module type with constraints no longer crash the compiler in presence of both shadowing warnings and the -bin-annot compiler flag. (Florian Angeletti, report by Christophe Raffalli, review by Gabriel Scherer)

  • #11392, #11392: assertion failure with -rectypes and external definitions (Gabriel Scherer, review by Florian Angeletti, report by Dmitrii Kosarev)

  • #11417: Fix regression allowing virtual methods in non-virtual classes. (Leo White, review by Florian Angeletti)

  • #11468: Fix regression from #10186 (OCaml 4.13) detecting IPv6 on Windows for mingw-w64 i686 port. (David Allsopp, review by Xavier Leroy and Sébastien Hinderer)

  • #11489, #11496: More prudent deallocation of alternate signal stack (Xavier Leroy, report by @rajdakin, review by Florian Angeletti)

  • #11516, #11524: Fix the deprecated_mutable attribute. (Chris Casinghino, review by Nicolás Ojeda Bär and Florian Angeletti)

  • #11194, #11609: Fix inconsistent type variable names in "unbound type var" messages (Ulysse Gérard and Florian Angeletti, review Florian Angeletti and Gabriel Scherer)

  • #11622: Prevent stack overflow when printing a constructor or record mismatch error involving recursive types. (Florian Angeletti, review by Gabriel Scherer)

  • #11732: Ensure that types from packed modules are always generalised (Stephen Dolan and Leo White, review by Jacques Garrigue)

  • #11737: Fix segfault condition in Unix.stat under Windows in the presence of multiple threads. (Marc Lasson, Nicolás Ojeda Bär, review by Gabriel Scherer and David Allsopp)

  • #11776: Extend environment with functor parameters in strengthen_lazy. (Chris Casinghino and Luke Maurer, review by Gabriel Scherer)

  • #11533, #11534: follow synonyms again in #show_module_type (this had stopped working in 4.14.0) (Gabriel Scherer, review by Jacques Garrigue, report by Yaron Minsky)

  • #11768, #11788: Fix crash at start-up of bytecode programs in no-naked-pointers mode caused by wrong initialisation of caml_global_data (Xavier Leroy, report by Etienne Millon, review by Gabriel Scherer)

The release of OCaml version 5.0.0 is imminent. As a final step before the release, we are publishing a release candidate that you can test while waiting for the release in the upcoming weeks.

If you find any bugs, please report them on OCaml's issue tracker.

Compared to the second beta release, this release contains one toplevel bug fix and a minor type system fix.

If you are interested by the bug fixes beyond the new Multicore runtime, the full change log for OCaml 5.0.0 is available on GitHub

A short summary of the changes since the second beta release is also available below.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 5.0.0~rc1

For previous version of opam, the switch creation command line is slightly more verbose:

opam update
opam switch create 5.0.0~rc1 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

It might be also interesting to check the new support for parallelism by installing the domainslib library with

opam install domainslib

The source code for the release candidate 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.0.0~rc1+options <option_list>

where <option_list> is a comma-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.0.0~rc1+flambda+nffa ocaml-variants.5.0.0~rc1+options ocaml-option-flambda ocaml-option-no-flat-float-array

The command line above is slightly more complicated for opam versions before 2.1:

opam update
opam switch create <switch_name> --packages=ocaml-variants.5.0.0~rc1+options,<option_list> --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

In both cases, all available options can be listed with opam search ocaml-option.

See full changelog

Changes Since the Second Beta Release

Bug Fixes

  • #11776: Extend environment with functor parameters in strengthen_lazy. (Chris Casinghino and Luke Maurer, review by Gabriel Scherer)

  • #11533, #11534: follow synonyms again in #show_module_type (this had stopped working in 4.14.0) (Gabriel Scherer, review by Jacques Garrigue, report by Yaron Minsky)

The release of OCaml 5.0.0 is drawing close.

In order to test the most recent bug fixes and to help you update your software and libraries ahead of the release, we have released a second beta version of OCaml 5.0.0, (see below for the installation instructions).

If you find any bugs, please report them on OCaml's issue tracker.

Compared to the first beta release, this second beta contains many small internal standard library fixes, one configuration fix and many small bug fixes.

We also have few updates of the documentation, which introduce two new alerts: one for the unstable modules Domain and Effect, and another for functions doing unsynchronized_access to mutable state in the standard library. Those two alerts are disabled by default, but are available for interested users.

The first release candidate for OCaml 5.0.0 is expected to follow closely this second beta release.

If you are interested in the ongoing list of bug fixes, the updated change log for OCaml 5.0.0 is available on GitHub.

You can also follow the state of the opam ecosystem on http://check.ocamllabs.io/.

A short summary of the changes since the first beta release is also available below.


Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 5.0.0~beta2

For previous versions of opam, the switch creation command line is slightly more verbose:

opam update
opam switch create 5.0.0~beta2 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

It might also be interesting to check the new support for parallelism by installing the domainslib library with

opam install domainslib

The source code for the beta release is also available at these addresses:

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.0.0~beta2+options <option_list>

where option_list is a comma-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.0.0~beta2+flambda+nffa ocaml-variants.5.0.0~beta2+options ocaml-option-flambda ocaml-option-no-flat-float-array

The command line above is slightly more complicated for opam versions before 2.1:

opam update
opam switch create <switch_name> --packages=ocaml-variants.5.0.0~beta2+options,<option_list> --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

In both cases, all available options can be listed with opam search ocaml-option.

See full changelog

Changes since the first beta

Configuration changes

  • #11097: Build native-code compilers on NetBSD/aarch64 (Kate Deplaix, review by Anil Madhavapeddy)

Bug fixes

  • #10875, +#11731: Add option to allocate fiber stacks and sigaltstacks with mmap(MAP_STACK) instead of malloc. This is exposed via a configure –enable-mmap-map-stack option, and is enabled by default on OpenBSD where it is mandatory. (Anil Madhavapeddy, review by Gabriel Scherer, Tom Kelly, Michael Hendricks and KC Sivaramakrishnan).
  • #11652: Fix benign off-by-one error in Windows implementation of caml_mem_map. (David Allsopp, review by Gabriel Scherer)
  • #11669, #11704: Fix construction of Effect.Unhandled exceptions in the bytecode interpreter. (David Allsopp and Xavier Leroy, report by Samuel Hym, review by Xavier Leroy and Gabriel Scherer)
  • #11184, +#11670: Stop calling ranlib on created / installed libraries (Sébastien Hinderer and Xavier Leroy, review by the same)
  • #11194, #11609: Fix inconsistent type variable names in “unbound type var” messages (Ulysse Gérard and Florian Angeletti, review Florian Angeletti and Gabriel Scherer)
  • #11622: Prevent stack overflow when printing a constructor or record mismatch error involving recursive types. (Florian Angeletti, review by Gabriel Scherer)
  • #11662, #11673: fix a memory leak when using Dynlink, the bug was only present in development version of OCaml 5. (Stephen Dolan, report by Andre Maroneze, review by Gabriel Scherer)
  • #11732: Ensure that types from packed modules are always generalised (Stephen Dolan and Leo White, review by Jacques Garrigue)
  • #11737: Fix segfault condition in Unix.stat under Windows in the presence of multiple threads. (Marc Lasson, Nicolás Ojeda Bär, review by Gabriel Scherer and David Allsopp)

Documentation

  • #11193, #11227: documentation on concurrency safety for mutable data types and states in the standard library. A unsynchronized_access alert have been added for functions that require user synchronizations on concurrent access. The new alert is diabled by default. (Florian Angeletti, review by François Pottier and KC Sivaramakrishnan )
  • #11526, add a unstable alert to the Domain and Effect modules. The new alert is disabled by default. (Florian Angeletti, review by Nicolás Ojeda Bär, Daniel Bünzli, and Kate Deplaix)
  • #11640: Add Flambda commonly-used options to the ocamlopt manpage (Amandine Nangah, review by David Allsopp, Florian Angeletti, Sébastien Hinderer, and Vincent Laviron)

The release of OCaml 5.0.0 is drawing near. The standard library has been stabilized and many opam packages already work with this release. After two alpha releases, we have released the first beta version to help you update your software and libraries ahead of the release (see below for the installation instructions).

If you find any bugs, please report them on GitHub issues.

Compared to the last alpha release, this beta contains many small, internal runtime fixes (in particular in the systhreads library).

At the user level, the interface of the Domain and Effect module has been tweaked to be (hopefully) more forward-compatible:

  • Exceptions related to effects are now defined in the Effecŧ module.
  • The value Domain.recommended_domain_count is no longer a constant and the function Domain.at_each_spawn has been removed.

With those changes, the standard library should be stable now.

If you are interested in the ongoing list of bug fixes, the updated change log for OCaml 5.0.0 is available on GitHub.

You can also follow the state of the opam ecosystem on this opam-repository issues, and at check.ocamllabs.io

A short summary of the changes since the last alpha release is also available below.

Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 5.0.0~beta1

For previous versions of opam, the switch creation command line is slightly more verbose:

opam update
opam switch create 5.0.0~beta1 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

It might also be interesting to check the new support for parallelism by installing the domainslib library with

opam install domainslib

The source code for the beta release is also available at these addresses:

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.0.0~beta1+options <option_list>

where option_list is a comma-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.0.0~beta1+flambda+nffa ocaml-variants.5.0.0~beta1+options ocaml-option-flambda ocaml-option-no-flat-float-array

The command line above is slightly more complicated for opam versions before 2.1:

opam update
opam switch create <switch_name> --packages=ocaml-variants.5.0.0~beta1+options,<option_list> --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

In both cases, all available options can be listed with opam search ocaml-option.

Optional opam Alpha Repository

During the beta release, if your dependencies are not yet compatible with OCaml 5.0.0, you might want to check the alpha opam repository: https://github.com/kit-ty-kate/opam-alpha-repository.

Which can be installed with

opam repo add alpha git+https://github.com/kit-ty-kate/opam-alpha-repository.git

You can check that the alpha repository has been correctly installed with

$ opam repo
<><> Repository configuration for switch 5.0.0~beta1 <><><><><><><><><><><><><>
 1 alpha   git+https://github.com/kit-ty-kate/opam-alpha-repository.git
 2 default https://opam.ocaml.org

This alpha repository contains various fixes that are in the process of being upstreamed, but it should be less and less required with the progress of the beta release.

See full changelog

Changes Since Last Alpha Release

Stdlib Changes

  • #11309, #11424, #11427, +#11545: Add Domain.recommended_domain_count. (Christiano Haesbaert, Konstantin Belousov, review by David Allsopp, KC Sivaramakrishnan, Gabriel Scherer, Nicolas Ojeda Bar)
  • #11423: Move the effect exceptions to the Effect module (KC Sivaramakrishnan, Xavier Leroy, Florian Angeletti, review by Florian Angeletti, Xavier Leroy, and KC Sivaramakrishnan)

  • #11593: Remove Domain.at_each_spawn (Florian Angeletti, review by Guillaume Munch-Maccagnoni and KC Sivaramakrishnan)

Bug Fixes

  • #11303: Ensure that GC is not invoked from bounds check failures (Stephen Dolan, review by Sadiq Jaffer and Xavier Leroy)

  • #5299, #4787, #11138, #11272, #11506: To help debugging, Caml_state now dynamically checks that the domain lock is held and fails otherwise (with a fatal error at most entry points of the C API, or systematically in debug mode). A new variable Caml_state_opt is introduced and is NULL when the domain lock is not held. This allows to test from C code if the current thread holds its domain lock. (Guillaume Munch-Maccagnoni, review by Florian Angeletti, Damien Doligez, Sadiq Jaffer, Xavier Leroy, and Gabriel Scherer)

  • #11223: The serialisation format of custom blocks changed in 4.08, but the deserialiser would still support the pre-4.08 format. OCaml 5.x removed support for this old format and provided a clear error message in this case. (Hugo Heuzard, review by Gabriel Scherer)

  • #11504, #11522: Use static allocation for caml_make_float_vect in no-flat-float-array mode, it's more efficient and avoids a race condition (Xavier Leroy, report by Guillaume Munch-Maccagnoni, review by David Allsopp)

  • #11461, #11466: Fix gethostbyaddr for IPv6 arguments and make it domain-safe (Olivier Nicole, Nicolás Ojeda Bär, David Allsopp and Xavier Leroy, review by the same)

  • #11479: Make Unix.symlink domain-safe on Windows (Olivier Nicole, review by Xavier Leroy and David Allsopp)

  • #11294: Switch minimum required autoconf to 2.71. (David Allsopp, review by Xavier Leroy)

  • #11370, #11373: Don't pass CFLAGS to flexlink during configure. (David Allsopp, report by William Hu, review by Xavier Leroy and Sébastien Hinderer)

  • #11487: Thwart FMA test optimization during configure (William Hu, review by David Allsopp and Sébastien Hinderer)

  • #11468: Fix regression from #10186 (OCaml 4.13) detecting IPv6 on Windows for mingw-w64 i686 port. (David Allsopp, review by Xavier Leroy and Sébastien Hinderer)

  • #11482, #11542: Fix random crash in large closure allocation (Damien Doligez, report by Thierry Martinez and Vincent Laviron, review by Xavier Leroy)

  • #11508, #11509: make Bytes.escaped domain-safe (Christiano Haesbaert and Gabriel Scherer, review by Xavier Leroy, report by Jan Midtgaard and Tom Kelly)

  • #11516, #11524: Fix the deprecated_mutable attribute. (Chris Casinghino, review by Nicolás Ojeda Bär and Florian Angeletti)

  • #11576: Fix bug in Bigarray.Genarray.init in the the case of zero-dimensional arrays. (Nicolás Ojeda Bär, Jeremy Yallop, report by Masayuki Takeda, review by Jeremy Yallop and Florian Angeletti)

  • #11587: Prevent integer comparison from being used on pointers (Vincent Laviron, review by Gabriel Scherer)

Documentation Changes

  • #11093: Add tutorials on parallelism features and the relaxed memory model (KC Sivaramakrishnan, review by Damien Doligez, Anil Madhavapeddy, Gabriel Scherer, Thomas Leonard, Tom Ridge, Xavier Leroy, Luc Maranget, Fabrice Buoro, Olivier Nicole, Guillaume Munch-Maccagnoni, Jacques-Henri Jourdan)
If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.