# Compiler Release Notes

## Compiler 4.2

### Fixed errors and malfunctions

- Three compiler problems fixed: 1) Constant expression were not evaluated at compile time as they should be (unless inlining was turned on). 2) In unusual cases, incorrect code would be generated for "," or "and" in guards. 3) A floating point expressions that failed (e.g. with overflow) and whose value was not used would cause the next floating point expression to fail on some Pentium platforms (Linux, possibly FreeBSD; not on Windows).
  (Own Id: OTP-4557)

- Misspelled atom names which looks like arithmetic expressions no longer causes compiler crashes.
  (Own Id: OTP-4617)
  (Aux Id: seq7626)

- Several minor compiler crash problems have been fixed.
  (Own Id: OTP-4765)

- Errors discovered by the Erlang pre-processor, such as re-definitions of macros, are now correctly reported. They used to be reported as "unknown POSIX error".
  (Own Id: OTP-4768)

- Under rare circumstances, a catch nested inside a catch in the same function would cause an emulator crash with the reason "Catch not found".
  (Own Id: OTP-4769)

### Improvements and new features

- For the bit syntax, it is now supported to match with a sizefield that is bound (from left to right) during the same matching. Example:
  `<<Size, B:Size/binary,Rest/binary>> = <<2,"AB",3,"CDE">>`
  During the matching Size is bound to 2 and then used as the size for B which will be bound to "AB" etc.
- The compiler will issue an warning for list comprenhensions without any generators.
  (Own Id: OTP-4618)

- The format of the debug information stored in beam files when the `debug_info` option is given has been changed. The debugger, xref, and cover tools in R9C have been updated to handle the new format (as well as the previous format). The R9B version of those tools `cannot` handle the new format.
  (Own Id: OTP-4688)

- When updating a record, the record is now always checked for the correct record tag and size. Earlier versions of the compiler did not consistently add such a test (depending on the size of the record and the number of fields updated).
  (*** POTENTIAL INCOMPATIBILITY ***)
  (Own Id: OTP-4764)

- The compiler produces slightly smaller and faster code for certain language features, such as 'andalso' and 'orelse'.
  (Own Id: OTP-4766)

## Compiler 4.1

### Fixed errors and malfunctions

- Fixed problem in optimizing of case patterns containing tuples.
  (Own Id: OTP-3973)
  (Aux Id: Seq 5243, Seq 7025)

- Using the 'not' operator in guards could crash the emulator.
  (Own Id: OTP-4194)
  (Aux Id: seq7196, seq7232, seq7253)

- A bug in the compilation of bit syntax matching could cause parts of the binary to be skipped.
  (Own Id: OTP-4219)
  (Aux Id: seq7218)

### Improvements and new features

- The documentation for the 'compile' module now lists several options that were previously undocumented or only documented in the 'erl_lint' documentation (such as the highly useful `warn_unused_vars`).
  (Own Id: OTP-4240)

- The `-include` and `-include_dir` directives substitute environment variable values for first path components beginning with a `$` (dollar) sign.
  (Own Id: OTP-4385)
  (Aux Id: seq7349)

- The endianess specification 'native' has been added to the bit syntax. It will resolve to either big or little endian at load time. It is specially useful for communcating with linked-in drivers.
  (Own Id: OTP-4458)

- 'try' and 'cond' are keywords in R9 and must not be used as atom names or field names in records (unless they are single-quoted). In the R9 release, the compiler options 'disable_try' and 'disable_cond' can be used to allow 'try' and 'cond' to be used as in previous releases (to allow compilation of old Erlang code).
  The 'disable_try'/'disable_cond' options will be removed in the R10 release.
  (*** POTENTIAL INCOMPATIBILITY ***)
  (Own Id: OTP-4464)

There are also release notes for older versions.