Skip to content

Commit

Permalink
Fix #13175, segfault with 👻 fields
Browse files Browse the repository at this point in the history
  • Loading branch information
simonster committed Sep 17, 2015
1 parent 5b82198 commit 5d0ba2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,7 @@ static Value *emit_bits_compare(const jl_cgval_t &arg1, const jl_cgval_t &arg2,
Value *subAns, *fld1, *fld2;
fld1 = builder.CreateConstGEP2_32(LLVM37_param(at) varg1, 0, i);
fld2 = builder.CreateConstGEP2_32(LLVM37_param(at) varg2, 0, i);
if (type_is_ghost(fld1->getType()))
if (type_is_ghost(fld1->getType()->getPointerElementType()))
continue;
subAns = emit_bits_compare(mark_julia_slot(fld1, fldty), mark_julia_slot(fld2, fldty), ctx);
answer = builder.CreateAnd(answer, subAns);
Expand Down
9 changes: 9 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3366,3 +3366,12 @@ end
typealias B11888{T} A11888{A11888{A11888{T}}}

@test sizeof(B11888{B11888{Int64}}) == (1 << 24) * 8

# issue #13175
immutable EmptyImmutable13175 end
immutable EmptyIIOtherField13175
x::EmptyImmutable13175
y::Float64
end
@test EmptyIIOtherField13175(EmptyImmutable13175(), 1.0) == EmptyIIOtherField13175(EmptyImmutable13175(), 1.0)
@test EmptyIIOtherField13175(EmptyImmutable13175(), 1.0) != EmptyIIOtherField13175(EmptyImmutable13175(), 2.0)

0 comments on commit 5d0ba2d

Please sign in to comment.