Skip to content

Commit

Permalink
Merge pull request #13650 from JuliaLang/sjk/13647
Browse files Browse the repository at this point in the history
Fix #13647, comparing boxed isbits immutables
  • Loading branch information
vtjnash committed Oct 16, 2015
2 parents 0d457dd + b09a4bd commit 3e0e063
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2071,10 +2071,10 @@ static Value *emit_bits_compare(const jl_cgval_t &arg1, const jl_cgval_t &arg2,
Type *atp = at->getPointerTo();
Value *varg1 = arg1.V;
if (varg1->getType() != atp)
builder.CreatePointerCast(varg1, atp);
varg1 = builder.CreatePointerCast(varg1, atp);
Value *varg2 = arg2.V;
if (varg2->getType() != atp)
builder.CreatePointerCast(varg2, atp);
varg2 = builder.CreatePointerCast(varg2, atp);
jl_svec_t *types = ((jl_datatype_t*)arg1.typ)->types;
Value *answer = ConstantInt::get(T_int1, 1);
size_t l = jl_svec_len(types);
Expand Down
14 changes: 14 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3436,3 +3436,17 @@ end
type IO13433 <: IO end
Base.read(::IO13433, ::Type{UInt8}) = 0x01
@test read!(IO13433(), Array(UInt8, 4)) == [0x01, 0x01, 0x01, 0x01]

# issue #13647, comparing boxed isbits immutables
immutable X13647
a::Int
b::Bool
end
function f13647(x, y)
z = false
z = y
x === z
end
@test f13647(X13647(1, false), X13647(1, false))
@test !f13647(X13647(1, false), X13647(1, true))
@test !f13647(X13647(2, false), X13647(1, false))

0 comments on commit 3e0e063

Please sign in to comment.