1 Compiler Release Notes
This document describes the changes made to the Compiler application.
1.1 Compiler 4.3
1.1.1 Fixed Bugs and Malfunctions
-
The semantics for boolean operators in guards have
been changed to be more consistent.
All boolean
operators will fail if given non-boolean arguments;
'true or garbage
' used to succeed but will now
fail. Also, failure in the evaluation of the operands
will also cause the guard to fail; 'true or element(1,
[])
' used to succeed but will now fail.
Semicolon
will behave as it used to. If a failure as described
above occurs, evaluation will continue with the right
operand of the semicolon.
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-4623
-
-compile(...)
attributes inside an Erlang module
can now contain compiler options that control warnings
(such as warn_unused_vars). They used to be ignored.
Own Id: OTP-4911
-
When a record was updated, and the record given as an
expression (such as function call), the record could be
evaluated more than once.
Own Id: OTP-4933
-
Compilation of modules with long strings could be
extremely slow.
Own Id: OTP-4960 Aux Id: seq8310
-
In bit syntax matching with clauses having guards,
sometimes the following clauses would never match if a
guard was evaluated (and failed).
Own Id: OTP-4961 Aux Id: seq8338, OTP-4891
-
Using multiple matching ('=') in the pattern for a
generator in list comprenhension would cause an internal
compiler error.
Example:
[3 || {3=4} <- []].
Own Id: OTP-5076 Aux Id: OTP-5092
-
List and string literals, and integer and character
literals were not equivalent in matching as they should
be. For instance,
f("a"=[$a])
would never match.
Own Id: OTP-5092 Aux Id: OTP-5076
1.1.2 Improvements and New Features
-
The compiler used to warn for definition of functions
having the same name as an auto-imported BIF (such as
size/1). In the R10B release, such warnings will only be
emitted if the function is NOT exported (because it will
be impossible to call it). Instead, there will be a
warning for any local call (call without module prefix)
to any (exported) function in the same module that is
also the name of an auto-imported BIF. To avoid the
warning, insert a module prefix (either 'erlang' to call
the BIF, or the name of the module to call function in
the module).
Own Id: OTP-4909
-
The unary '+' operator has been changed to throw an
'badarith' exception if its argument is not numeric (or
fail in a guard). It used its argument unchanged whatever
the type. Given the new meaning, unary '+' can now be
used to test whether a term is numeric.
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-4928
-
The compiler now warns for more types of suspect code,
such as expressions that will fail at run-time (such as
atom-42
), guards that are always false, or
patterns that cannot match.
Own Id: OTP-5098 Aux Id: seq8965, OTP-2456
-
The long-awaited
try
...catch
construction
is included in this release. However, its use in
production code is not yet supported as there are several
known cases of legal code crashing the compiler. We plan
to release a patch to the compiler (including the
documentation) and at that time try
...catch
will be supported.
Own Id: OTP-5150
1.2 Compiler 4.2.3
1.2.1 Fixed Bugs and Malfunctions
-
The compiler could generate incorrect code for receive
clauses did not use the message in any way, for instance
if a guard would ignore message depending on some
condition not based on the contents of the message (e.g.
a state variable in the "loop data").
Own Id: OTP-5050
1.3 Compiler 4.2.2
1.3.1 Fixed Bugs and Malfunctions
-
Compilation of modules with long strings could be
extremely slow.
Own Id: OTP-4960 Aux Id: seq8310
-
In bit syntax matching with clauses having guards,
sometimes the following clauses would never match if a
guard was evaluated (and failed).
Own Id: OTP-4961 Aux Id: seq8338, OTP-4891
-
In (Expr)#rec{a=A,b=B}, Expr would be evaluated more than
once.
Own Id: OTP-4962 Aux Id: seq8292
1.4 Compiler 4.2.1
1.4.1 Improvements and New Features
-
In rare circumstances, the compiler could optimize away
test that would verify that a tuple or record argument
indeed was of the correct type (resulting in an emulator
crash if the argument was not of the correct type/size).
Wrong code could also be generated for floating point
expressions.
Own Id: OTP-4790
Copyright © 1991-2004
Ericsson AB