Skip to content

Commit

Permalink
fix codegen for getfield of homogeneous tuples (#34243)
Browse files Browse the repository at this point in the history
fix #34206, fix #34207
  • Loading branch information
JeffBezanson committed Jan 3, 2020
1 parent 0b034fd commit 007cb29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2903,8 +2903,11 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
emit_datatype_nfields(ctx, emit_typeof_boxed(ctx, obj)),
jl_true);
}
bool isboxed = !jl_datatype_isinlinealloc(jt);
Value *ptr = maybe_decay_tracked(data_pointer(ctx, obj));
*ret = typed_load(ctx, ptr, vidx, jt, obj.tbaa, nullptr, false);
*ret = typed_load(ctx, ptr, vidx,
isboxed ? (jl_value_t*)jl_any_type : jt,
obj.tbaa, nullptr, false);
return true;
}
}
Expand Down
8 changes: 8 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7156,3 +7156,11 @@ struct B33954
end
@test_broken isbitstype(Tuple{B33954})
@test_broken isbitstype(B33954)

# Issue #34206/34207
function mre34206(a, n)
va = view(a, :)
b = ntuple(_ -> va, n)::Tuple{Vararg{typeof(va)}}
return b[1].offset1
end
@test mre34206([44], 1) == 0

0 comments on commit 007cb29

Please sign in to comment.