Skip to content

Commit 2fca4d3

Browse files
committed
fix codegen bug in === on two SimpleVectors
1 parent 79ff734 commit 2fca4d3

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/codegen.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,8 @@ static Value *emit_f_is(jl_codectx_t &ctx, const jl_cgval_t &arg1, const jl_cgva
23492349
if ((jl_is_type_type(rt1) && jl_is_leaf_type(jl_tparam0(rt1))) ||
23502350
(jl_is_type_type(rt2) && jl_is_leaf_type(jl_tparam0(rt2)))) // can compare leaf types by pointer
23512351
ptr_comparable = 1;
2352+
if (rt1 == (jl_value_t*)jl_simplevector_type && rt2 == (jl_value_t*)jl_simplevector_type)
2353+
ptr_comparable = 0; // technically mutable, but compared by contents
23522354
if (ptr_comparable) {
23532355
Value *varg1 = arg1.constant ? literal_pointer_val(ctx, arg1.constant) : arg1.V;
23542356
Value *varg2 = arg2.constant ? literal_pointer_val(ctx, arg2.constant) : arg2.V;

test/codegen.jl

+8
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,11 @@ let was_gced = false
183183
end
184184
foo22770()
185185
end
186+
187+
function egal_svecs()
188+
a = Core.svec(:a, :b)
189+
b = Core.svec(:a, :b)
190+
a === b
191+
end
192+
@test egal_svecs()
193+
@test Core.svec(:a, :b) === Core.svec(:a, :b)

0 commit comments

Comments
 (0)