Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #41654, layout of 0-field structs with circular supertypes #41660

Merged
merged 1 commit into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -1557,9 +1557,9 @@ JL_CALLABLE(jl_f__typebody)
// able to compute the layout of the object before needing to
// publish it, so we must assume it cannot be inlined, if that
// check passes, then we also still need to check the fields too.
if (!dt->name->mutabl && !references_name((jl_value_t*)dt->super, dt->name, 1)) {
if (!dt->name->mutabl && (nf == 0 || !references_name((jl_value_t*)dt->super, dt->name, 1))) {
int mayinlinealloc = 1;
size_t i, nf = jl_svec_len(ft);
size_t i;
for (i = 0; i < nf; i++) {
jl_value_t *fld = jl_svecref(ft, i);
if (references_name(fld, dt->name, 1)) {
Expand Down
6 changes: 6 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7236,6 +7236,12 @@ end
@test string((B40050(),)) == "($B40050(),)"
@test_broken isbitstype(Tuple{B40050})

# issue #41654
struct X41654 <: Ref{X41654}
end
@test isbitstype(X41654)
@test ('a'=>X41654(),)[1][2] isa X41654

# Issue #34206/34207
function mre34206(a, n)
va = view(a, :)
Expand Down