Skip to content

Commit

Permalink
Merge pull request #22946 from JuliaLang/jb/svecegal
Browse files Browse the repository at this point in the history
fix codegen bug in `===` on two `SimpleVector`s
  • Loading branch information
JeffBezanson authored Jul 25, 2017
2 parents 00ee0ab + 2fca4d3 commit 9186ae4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2349,6 +2349,8 @@ static Value *emit_f_is(jl_codectx_t &ctx, const jl_cgval_t &arg1, const jl_cgva
if ((jl_is_type_type(rt1) && jl_is_leaf_type(jl_tparam0(rt1))) ||
(jl_is_type_type(rt2) && jl_is_leaf_type(jl_tparam0(rt2)))) // can compare leaf types by pointer
ptr_comparable = 1;
if (rt1 == (jl_value_t*)jl_simplevector_type && rt2 == (jl_value_t*)jl_simplevector_type)
ptr_comparable = 0; // technically mutable, but compared by contents
if (ptr_comparable) {
Value *varg1 = arg1.constant ? literal_pointer_val(ctx, arg1.constant) : arg1.V;
Value *varg2 = arg2.constant ? literal_pointer_val(ctx, arg2.constant) : arg2.V;
Expand Down
8 changes: 8 additions & 0 deletions test/codegen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,11 @@ let was_gced = false
end
foo22770()
end

function egal_svecs()
a = Core.svec(:a, :b)
b = Core.svec(:a, :b)
a === b
end
@test egal_svecs()
@test Core.svec(:a, :b) === Core.svec(:a, :b)

0 comments on commit 9186ae4

Please sign in to comment.