Skip to content

Commit e6b2a8e

Browse files
JeffBezansonKristofferC
authored andcommitted
fix codegen for getfield of homogeneous tuples (#34243)
fix #34206, fix #34207 (cherry picked from commit 007cb29)
1 parent 03fc530 commit e6b2a8e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/codegen.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2903,8 +2903,11 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
29032903
emit_datatype_nfields(ctx, emit_typeof_boxed(ctx, obj)),
29042904
jl_true);
29052905
}
2906+
bool isboxed = !jl_datatype_isinlinealloc(jt);
29062907
Value *ptr = maybe_decay_tracked(data_pointer(ctx, obj));
2907-
*ret = typed_load(ctx, ptr, vidx, jt, obj.tbaa, nullptr, false);
2908+
*ret = typed_load(ctx, ptr, vidx,
2909+
isboxed ? (jl_value_t*)jl_any_type : jt,
2910+
obj.tbaa, nullptr, false);
29082911
return true;
29092912
}
29102913
}

test/core.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7156,3 +7156,11 @@ struct B33954
71567156
end
71577157
@test_broken isbitstype(Tuple{B33954})
71587158
@test_broken isbitstype(B33954)
7159+
7160+
# Issue #34206/34207
7161+
function mre34206(a, n)
7162+
va = view(a, :)
7163+
b = ntuple(_ -> va, n)::Tuple{Vararg{typeof(va)}}
7164+
return b[1].offset1
7165+
end
7166+
@test mre34206([44], 1) == 0

0 commit comments

Comments
 (0)