aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2014-03-01 19:48:28 +0100
committerHans Bolinder <[email protected]>2014-03-03 08:50:46 +0100
commit28d4b0cfc27826d7b273edd0143c7dc2f14bf86e (patch)
tree2683781505b71e42d224b36b017ee920092b25ad /lib/stdlib/src
parenta74e66a68f3b4ed590f928b4fd4f0808c6287a32 (diff)
downloadotp-28d4b0cfc27826d7b273edd0143c7dc2f14bf86e.tar.gz
otp-28d4b0cfc27826d7b273edd0143c7dc2f14bf86e.tar.bz2
otp-28d4b0cfc27826d7b273edd0143c7dc2f14bf86e.zip
Fix a qlc bug where filters were erroneously optimized away
Thanks to Sam Bobroff for reporting the bug.
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r--lib/stdlib/src/qlc_pt.erl11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/stdlib/src/qlc_pt.erl b/lib/stdlib/src/qlc_pt.erl
index c26764eb18..b6bb758dfb 100644
--- a/lib/stdlib/src/qlc_pt.erl
+++ b/lib/stdlib/src/qlc_pt.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -1218,13 +1218,14 @@ lu_skip(ColConstants, FilterData, PatternFrame, PatternVars,
%% column, the filter will not be skipped.
%% (an example: {X=1} <- ..., X =:= 1).
length(D = Cols -- PatternColumns) =:= 1,
- Frame <- SFs,
- begin
+ {{_,Col} = Column, Constants} <- D,
+ %% Check that the following holds for all frames.
+ lists:all(
+ fun(Frame) ->
%% The column is compared/matched against a constant.
%% If there are no more comparisons/matches then
%% the filter can be replaced by the lookup of
%% the constant.
- [{{_,Col} = Column, Constants}] = D,
{VarI, FrameI} = unify_column(Frame, PV, Col, BindFun,
Imported),
VarValues = deref_skip(VarI, FrameI, LookupOp, Imported),
@@ -1253,7 +1254,7 @@ lu_skip(ColConstants, FilterData, PatternFrame, PatternVars,
length(VarValues) =< 1 andalso
(Constants -- LookedUpConstants =:= []) andalso
bindings_is_subset(Frame, F2, Imported)
- end],
+ end, SFs)],
ColFils = family_list(ColFil),
%% The skip tag 'all' means that all filters are covered by the lookup.
%% It does not imply that there is only one generator as is the case