diff --git a/src/cmd/compile/internal/gc/plive.go b/src/cmd/compile/internal/gc/plive.go index 7d3377f40c..6abbfe757e 100644 --- a/src/cmd/compile/internal/gc/plive.go +++ b/src/cmd/compile/internal/gc/plive.go @@ -304,7 +304,7 @@ func (lv *Liveness) valueEffects(v *ssa.Value) (int32, liveEffect) { var effect liveEffect // Read is a read, obviously. // - // Addr is a read also, as any subseqent holder of the pointer must be able + // Addr is a read also, as any subsequent holder of the pointer must be able // to see all the values (including initialization) written so far. // This also prevents a variable from "coming back from the dead" and presenting // stale pointers to the garbage collector. See issue 28445. @@ -1450,12 +1450,25 @@ func liveness(e *ssafn, f *ssa.Func, pp *Progs) LivenessMap { return lv.livenessMap } +// TODO(cuonglm,mdempsky): Revisit after #24416 is fixed. func isfat(t *types.Type) bool { if t != nil { switch t.Etype { - case TSTRUCT, TARRAY, TSLICE, TSTRING, + case TSLICE, TSTRING, TINTER: // maybe remove later return true + case TARRAY: + // Array of 1 element, check if element is fat + if t.NumElem() == 1 { + return isfat(t.Elem()) + } + return true + case TSTRUCT: + // Struct with 1 field, check if field is fat + if t.NumFields() == 1 { + return isfat(t.Field(0).Type) + } + return true } }