Source file test/codegen/issue52635.go
1 // asmcheck 2 3 // Copyright 2022 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 // Test that optimized range memclr works with pointers to arrays. 8 9 package codegen 10 11 type T struct { 12 a *[10]int 13 b [10]int 14 } 15 16 func (t *T) f() { 17 // amd64:".*runtime.memclrNoHeapPointers" 18 for i := range t.a { 19 t.a[i] = 0 20 } 21 22 // amd64:".*runtime.memclrNoHeapPointers" 23 for i := range *t.a { 24 t.a[i] = 0 25 } 26 27 // amd64:".*runtime.memclrNoHeapPointers" 28 for i := range t.a { 29 (*t.a)[i] = 0 30 } 31 32 // amd64:".*runtime.memclrNoHeapPointers" 33 for i := range *t.a { 34 (*t.a)[i] = 0 35 } 36 } 37