Age | Commit message (Collapse) | Author |
|
The following code could crash the compiler:
f(X = true) when X or true or X -> ok.
Reported-by: Ulf Norell
|
|
Expressions such as erlang:'or'(bar, true) can make beam_bool crash if it tries
to optimize them, as this code is not quite really written by users, no attempt
to rewrite them more efficiently should be done, for simplicity's sake.
Reported-by: Ulf Norell
|
|
|
|
beam_utils:is_not_used_at/3 could be very slow for complex guards,
because the cached result for previously encountered labels were
neither used nor updated within blocks.
Reported-by: Magnus Müller
|
|
|
|
Run testcases in parallel will make the test suite run slightly
faster. Another reason for this change is that we want more testing
of parallel testcase support in common_test.
|
|
In 3d0f4a3085f11389e5b22d10f96f0cbf08c9337f (an update to conform
with common_test), in all test_lib:recompile(?MODULE) calls, ?MODULE
was changed to the actual name of the module. That would cause
test_lib:recompile/1 to compile the module with the incorrect
compiler options in cloned modules such as record_no_opt_SUITE,
causing worse coverage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* bg/compiler-cover-and-clean:
v3_life: Remove clause that cannot match in match_fail/3
v3_life tests: Cover exception handling code in v3_life:function/1
beam_type: Remove redundant clause
v3_core tests: Cover make_bool_switch_guard/5
v3_core tests: Cover handling of pattern aliases
v3_core: Remove a clause in is_simple/1 that cannot match
v3_core: Remove unused support for generating compilation errors
Remove stray support for the put_literal/2 instruction
Remove stray support for the bs_bits_to_bytes2/2 instruction
Remove the bs_bits_to_bytes/3 instruction
Cover handling of 'math' BIFs
beam_bool: Remove a clause in live_regs/1 that cannot match
beam_bool: Cover handling of bs_context_to_binary in initialized_regs/2
beam_bool: Remove a clause in initialized_regs/2 that cannot match
beam_block: Remove a clause that will never be executed
erts: Stop supporting non-literal empty tuples
compile: Remove code that is only executed on Solaris
Do not cover-analyze core_scan
core_SUITE_data: Don't ignore *.core files in this directory
OTP-8636 bg/compiler-cover-and-clean
|
|
|
|
The following code (by Simon Cornish)
bad(XDo1, XDo2, Do3) ->
Do1 = (XDo1 =/= []),
Do2 = (XDo2 =/= []),
CH1 = if Do1 == true;
Do1 == false,Do2==false,Do3 == blah ->
ch1;
true ->
no
end,
CH2 = if Do1 == true;
Do1 == false,Do2==false,Do3 == xx ->
ch2;
true ->
no
end,
{CH1,CH2}.
is optimized by beam_bool even though the optimization is not
safe. The trouble is that an assignment to {y,0} no longer
occurs on all paths leading to its use.
The bug is in dst_regs/2 which is supposed to return a set
of all registers assigned in a code block, but it ignores
registers assigned in 'move' instructions.
Fix the bug by taking 'move' instructions into account. This change
is safe since it can only cause more registers to be added
to the MustBeKilled and MustBeUnused sets in ensure_opt_safe/6,
which means that it can only cause the optimization to be turned
off for code that used to be optimized.
|
|
The following code crashes beam_bool:
bad(XDo1, XDo2, Do3) ->
Do1 = (XDo1 =/= []),
Do2 = (XDo2 =/= []),
if Do1 =:= true;
Do1 =:= false, Do2 =:= false, Do3 =:= delete ->
no
end.
(Reported by Simon Cornish; minimized by Kostis Sagonas.)
For the moment fix the bug in the simplest and safest way possible
(basically, instead of crashing just don't do the optimization).
In a future major release (e.g. R14), the following improvements
could be considered:
* In beam_bool, it should be possible to move the Do1 and Do2
expressions to the pre-block and still optimize the expression
in the 'if' statement.
* In sys_core_fold, it should be possible to eliminate the
try/catch around the guard expression in the 'if', because
none of the guard tests can actually fail.
|
|
|