Skip to content

Commit 0e96c9c

Browse files
maleadtKristofferC
authored andcommitted
Fix getfield codegen for tuple inputs and unknown symbol fields. (#51234)
(cherry picked from commit eab8d6b)
1 parent 46617e5 commit 0e96c9c

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3830,7 +3830,7 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
38303830
}
38313831
else if (fld.typ == (jl_value_t*)jl_symbol_type) { // Known type but unknown symbol
38323832
if (jl_is_datatype(utt) && (utt != jl_module_type) && jl_struct_try_layout(utt)) {
3833-
if ((jl_datatype_nfields(utt) == 1 && !jl_is_namedtuple_type(utt))) {
3833+
if ((jl_datatype_nfields(utt) == 1 && !jl_is_namedtuple_type(utt) && !jl_is_tuple_type(utt))) {
38343834
jl_svec_t *fn = jl_field_names(utt);
38353835
assert(jl_svec_len(fn) == 1);
38363836
Value *typ_sym = literal_pointer_val(ctx, jl_svecref(fn, 0));

test/compiler/codegen.jl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -849,15 +849,6 @@ let res = @timed a50317[:b]
849849
return res
850850
end
851851

852-
# Very specific test for multiversioning
853-
if Sys.ARCH === :x86_64
854-
foo52079() = Core.Intrinsics.have_fma(Float64)
855-
if foo52079() == true
856-
let io = IOBuffer()
857-
code_native(io,^,(Float64,Float64), dump_module=false)
858-
str = String(take!(io))
859-
@test !occursin("fma_emulated", str)
860-
@test occursin("vfmadd", str)
861-
end
862-
end
863-
end
852+
# https://github.com/JuliaLang/julia/issues/51233
853+
obj51233 = (1,)
854+
@test_throws ErrorException obj51233.x

0 commit comments

Comments
 (0)