Source file test/fixedbugs/issue25516.go
1 // compile 2 3 // Copyright 2018 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 // Make sure dead write barriers are handled correctly. 8 9 package main 10 11 func f(p **int) { 12 // The trick here is to eliminate the block containing the write barrier, 13 // but only after the write barrier branches are inserted. 14 // This requires some delicate code. 15 i := 0 16 var b []bool 17 var s string 18 for true { 19 if b[i] { 20 var a []string 21 s = a[len(s)] 22 i = 0 23 } 24 *p = nil 25 } 26 } 27