Skip to content

Commit

Permalink
Fix getfield codegen for tuple inputs and unknown symbol fields. (#51234
Browse files Browse the repository at this point in the history
)

(cherry picked from commit eab8d6b)
  • Loading branch information
maleadt authored and KristofferC committed Nov 28, 2023
1 parent 46617e5 commit 0e96c9c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3830,7 +3830,7 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
}
else if (fld.typ == (jl_value_t*)jl_symbol_type) { // Known type but unknown symbol
if (jl_is_datatype(utt) && (utt != jl_module_type) && jl_struct_try_layout(utt)) {
if ((jl_datatype_nfields(utt) == 1 && !jl_is_namedtuple_type(utt))) {
if ((jl_datatype_nfields(utt) == 1 && !jl_is_namedtuple_type(utt) && !jl_is_tuple_type(utt))) {
jl_svec_t *fn = jl_field_names(utt);
assert(jl_svec_len(fn) == 1);
Value *typ_sym = literal_pointer_val(ctx, jl_svecref(fn, 0));
Expand Down
15 changes: 3 additions & 12 deletions test/compiler/codegen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -849,15 +849,6 @@ let res = @timed a50317[:b]
return res
end

# Very specific test for multiversioning
if Sys.ARCH === :x86_64
foo52079() = Core.Intrinsics.have_fma(Float64)
if foo52079() == true
let io = IOBuffer()
code_native(io,^,(Float64,Float64), dump_module=false)
str = String(take!(io))
@test !occursin("fma_emulated", str)
@test occursin("vfmadd", str)
end
end
end
# https://github.com/JuliaLang/julia/issues/51233
obj51233 = (1,)
@test_throws ErrorException obj51233.x

0 comments on commit 0e96c9c

Please sign in to comment.