aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-03-17 16:04:52 +0100
committerBjörn Gustavsson <[email protected]>2010-03-26 08:03:42 +0100
commite2074da57e6dd9b68a39ae71771b28c8f704196f (patch)
treeb31951c40319107fa39e00e3b337a2da99193400 /lib/compiler/src
parenta2c88ff1875a2039c987c1099e6d911f1b6dfce6 (diff)
downloadotp-e2074da57e6dd9b68a39ae71771b28c8f704196f.tar.gz
otp-e2074da57e6dd9b68a39ae71771b28c8f704196f.tar.bz2
otp-e2074da57e6dd9b68a39ae71771b28c8f704196f.zip
compiler: Fix binary matching bug in the inliner
The inliner incorrectly assumes that a literal cannot match a binary in code such as: t() -> bc(<<"string">>). bc(<<A:1,T/bits>>) -> [A|bc(T)]; bc(<<>>) -> []. The bug was introduced when binary literals were introduced.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/cerl_clauses.erl15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/compiler/src/cerl_clauses.erl b/lib/compiler/src/cerl_clauses.erl
index 5f111a5e05..bb0f998931 100644
--- a/lib/compiler/src/cerl_clauses.erl
+++ b/lib/compiler/src/cerl_clauses.erl
@@ -338,10 +338,19 @@ match(P, E, Bs) ->
if E =:= any ->
{false, Bs};
true ->
- case is_data(E) of
- true ->
+ case type(E) of
+ literal ->
+ case is_bitstring(concrete(E)) of
+ false ->
+ none;
+ true ->
+ {false, Bs}
+ end;
+ cons ->
none;
- false ->
+ tuple ->
+ none;
+ _ ->
{false, Bs}
end
end;