2.2. Version 9.0.2 — Glasgow Haskell Compiler 9.0.2 User's Guide

# 2.2. Version 9.0.2

The significant changes to the various parts of the compiler are listed in the following sections.

The `LLVM backend` of this release is to be used with LLVM versions 9 through 12.

## 2.2.1. Highlights

- First-class support for Apple M1 hardware using GHC’s LLVM ARM backend.
- Fixes for a number of critical compiler and runtime system correctness bugs.
- Improved compiler performance and memory usage.

## 2.2.2. General bug fixes

- Fix incorrect rewrite rules for `fromInteger` resulting in incorrect code when compiling with optimisations (#19345, #20066).
- Unify primary and secondary GHCi prompts (#20042).
- Warn if Unicode Bidirectional Formatting characters are found in the source, possibly misleading code reviewers (#20263).
- Fix a memory leak in the simplifier, leading to the consumption of more memory on each iteration (#20134).
- Reduce memory usage in `--make` mode (#13586).
- Fix a long standing bug in constraint solving which lead to incorrect build failures (#19315).
- Fix a a bug affecting the demand analyser which lead to runtime crashes when compiling with optimisation (#18638).
- Fix a bug where code may be unloaded prematurely when using the parallel garbage collector (see #19417).
- Fix a long standing GHC API bug affecting clients like Haskell Language Server where async exceptions used to cancel threads during typechecking would be caught by the Template Haskell evaluator and reported as compile errors (#19410).
- Fix an inconsistency in the way GHC calls typechecker plugins where slightly different typechecker environment would be made available as an argument as compared to the monadic environment (see #19191).
- Greatly improve performance and memory usage while compiling modules with many partial type signatures and `-Wno-partial-type-signatures`
- Fix a bug where the linker may during shutdown unload code before libraries’ `atexit` handlers have a chance to run (#19297).
- Improvements to code generation (#19581).
- Fix a bug where levity monomorphic programs would be incorrectly rejected (#19522).
- Fix a typechecker bug which lead to an assertion failure while compiling certain programs with `-XLinearTypes` (#19400).
- Fix some RTS statistic calculations when using more than one thread with the parallel GC (#19147).
- Fix a bug where an imported `main` function would not be recognised (#19397).
- Fix a bug where unboxed objects would be entered, leading to runtime crashes (#19645).
- Fix a regression causing compiler panics during the STG conversion (#19700).
- Disallow `-XDerivingVia` when `-XSafe` is on (#19786).
- Fix a bug where using `magicDict` in GHCi would lead to a crash (#19667).
- Fix a bug with the constructed product result (CPR) analysis involving usages of `runRW#` (#19822).
- Fix a compiler performance issue causing exponential blowup during zonking/typechecking (#19668).
- Improve sharing of join points (#19996).
- Fix a compiler panic involving used existential type variables (#19849).
- Avoid including the path source file in the interface fingerprint, allowing interface files to be more portable (#16956).
- Fix some timer races in the RTS possibly manifesting in #18033 and #20132.
- Fix a crash on the non-moving GC due to incorrect logic for calculating the header size for array write barries (#19715).
- Fix a bug with the decoding of strings involving the null byte in the optimiser (#19976).
- Fix a bug with the parser leading to the incorrect rejection of programs mixing infix operators and `-XLexicalNegation` (#19838).
- Export more functions from `GHC.Tc.Errors.Hole` for use by plugin authors (#19864).
- Fix a bug in `base` leading to a high likelihood of space leaks when using lazy bytestrings. (#20107).
- Fix some memory ordering issues manifesting on aarch64-darwin due to an RTS bug (#20093).
- Fix a bug leading to typechecker errors being discarded inside splices (#20179, #19470).
- Fix some spurious warnings arising from the interaction between `-Wunused-packages` and reexported modules (#19518, #19777, #20242).
- Fix an RTS bug causing `allocateExec` to fail with certain versions of `libffi` (#20051).
- Fix an RTS bug resulting a crash `m32_allocator_init: Failed to map` (#19421).
- Stop leaking defunct llc processes (#20305).
- Fix an bug with the non moving GC leading to crashes due to missing write barriers (#20399, #20414).
- Improve code generator performance by elminating a few thunks (#19471).
- Fix a memory leak when using GHCi with `-fno-code` (#20509).
- Fix a bug in the RTS linker where `mmapForLinkerMarkExecutable` could be called with a zero-length argument, leading to undefined behaviouar (#20648).
- Fix a bug with the GC resulting in object code being prematurely collected leading to runtime crashes (#20649).
- `GHC.Event.Manager`: Don’t use one-shot kqueue on macOS. This reverts a commit that removed the workaround for a bug (#7651) in the OSX implementation of kqueue. It turns out the bug still affects modern macOS versions, so we keep the workaround for now. (#20662).
- Check the buffer size before calling the continuation in `withEncodedCString` (#20107).
- Pass `-DLIBICONV_PLUG` when building base library on FreeBSD (#19958).
- Make unsafeDupablePerformIO have a lazy demand (#19181).
- Fix accidental unsoundness in `Data.Typeable.Internal.mkTypeLitFromString` (#19288).

## 2.2.3. Packaging fixes

- Fix packaging of Windows extra tarballs (#19316).
- Fix Windows build with autoconf >= 2.7.0 (#19189).
- Fix make build system reading the ghc user package environment (#18988).
- Fix leakage of GHC in PATH into build artifacts (#19485).
- Include hyperlinked sources in released haddock documentation (#19455).
- Don’t include `configure` scripts in Windows bindist. (#19868).
- Ship both both versioned and unversioned executables with the hadrian bindist. (#20074).
- Give `ghc-pkg` the same version as `ghc` (#20087).
- Bump process submodule to 1.6.13.2 , fixing a number of correctness bugs on AArch64 Darwin backends (#19994).
- Fix the location of haddock files in the installed pkgconfs (#20427).
- Bump `process` to 1.6.13.2
- Bump `terminfo` to 0.4.1.5
- Bump `base` to 4.15.1.0
- Bump `Win32` to 2.12.0.1
- Bump `haskeline` to 0.8.2
- Bump `ghc-bignum` to 1.1
- Bump `haddock` to 2.25.1
- Bump `text` to 1.2.5.0
- Bump `Cabal` to 3.4.1.0
- Bump `directory` to 1.3.6.2

## 2.2.4. Portability fixes

- Fix an issue making GHC unable to build on FreeBSD due to an undefined reference to `libiconv`. (#19958).
- Match the C calling convention on platforms like s390x by sign/zero extending parameters for foreign calls. (#19023).
- Fix an issue resulting in build failures on certains platforms due to conflicting types for `environ` (#20512).
- Fix `xxHash` duplicate symbol errors on FreeBSD. (#19948).
- Properly honour `-fno-use-rpaths` on darwin. (#20004).
- Fix an issue causing libraries like `network` to fail building due to incorrect linker paths. (#19968).
- Fix a linking portability issue on macOS that resulted in undefined symbol errors for `___darwin_check_fd_set_overflow` (#19950).
- PowerPC: fix unsigned compare with 16-bit constants (#19852, #19609)
- Fix “undefined reference to libiconv” errors when compiling on FreeBSD (#19958)
- Allow the RTS to be compiled with a C++ compiler (#20394)
- Don’t rely on `realpath` in the binary distribution makefile (#19963)
- Fix “conflicting types for ‘environ’” error with certian glibc versions (#20512, #20577)

## 2.2.5. Included libraries

The package database provided with this distribution also contains a number of packages other than GHC itself. See the changelogs provided with these packages for further change information.

Package | Version | Reason for inclusion
--- | --- | ---
ghc | 9.0.2 | The compiler itself
Cabal | 3.4.1.0 | Dependency of `ghc-pkg` utility
Win32 | 2.12.0.1 | Dependency of `ghc` library
array | 0.5.4.0 | Dependency of `ghc` library
base | 4.15.1.0 | Core library
binary | 0.8.8.0 | Dependency of `ghc` library
bytestring | 0.10.12.1 | Dependency of `ghc` library
containers | 0.6.4.1 | Dependency of `ghc` library
deepseq | 1.4.5.0 | Dependency of `ghc` library
directory | 1.3.6.2 | Dependency of `ghc` library
exceptions | 0.10.4 | Dependency of `ghc` and `haskeline` library
filepath | 1.4.2.1 | Dependency of `ghc` library
ghc-boot-th | 9.0.2 | Internal compiler library
ghc-boot | 9.0.2 | Internal compiler library
ghc-compact | 0.1.0.0 | Core library
ghc-heap | 9.0.2 | GHC heap-walking library
ghc-prim | 0.7.0 | Core library
ghci | 9.0.2 | The REPL interface
haskeline | 0.8.2 | Dependency of `ghci` executable
hpc | 0.6.1.0 | Dependency of `hpc` executable
integer-gmp | 1.1 | Core library
libiserv | 9.0.2 | Internal compiler library
mtl | 2.2.2 | Dependency of `Cabal` library
parsec | 3.1.14.0 | Dependency of `Cabal` library
pretty | 1.1.3.6 | Dependency of `ghc` library
process | 1.6.13.2 | Dependency of `ghc` library
stm | 2.5.0.0 | Dependency of `haskeline` library
template-haskell | 2.17.0.0 | Core library
terminfo | 0.4.1.5 | Dependency of `haskeline` library
text | 1.2.5.0 | Dependency of `Cabal` library
time | 1.9.3 | Dependency of `ghc` library
transformers | 0.5.6.2 | Dependency of `ghc` library
unix | 2.7.2.2 | Dependency of `ghc` library
xhtml | 3000.2.2.1 | Dependency of `haddock` executable