Skip to content

Commit

Permalink
fix codegen bug in === on two SimpleVectors
Browse files Browse the repository at this point in the history
Ref #22946
(cherry picked from commit 2fca4d3)
  • Loading branch information
JeffBezanson authored and ararslan committed Sep 16, 2017
1 parent 776be41 commit 7994c64
Show file tree
Hide file tree
Showing 2 changed files with 11 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 @@ -2620,6 +2620,8 @@ static Value *emit_f_is(const jl_cgval_t &arg1, const jl_cgval_t &arg2, jl_codec
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(arg1.constant) : arg1.V;
Value *varg2 = arg2.constant ? literal_pointer_val(arg2.constant) : arg2.V;
Expand Down
9 changes: 9 additions & 0 deletions test/codegen.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

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 7994c64

Please sign in to comment.