Source file test/fixedbugs/issue54467.go

     1  // run
     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  package main
     8  
     9  import "fmt"
    10  
    11  func main() {
    12  	var x [64]byte
    13  	for i := range x {
    14  		x[i] = byte(i)
    15  	}
    16  	y := x
    17  
    18  	copy(x[4:36], x[2:34])
    19  	*(*[32]byte)(y[4:36]) = *(*[32]byte)(y[2:34])
    20  
    21  	for i := range x {
    22  		if x[i] != y[i] {
    23  			fmt.Printf("x[%v] = %v; y[%v] = %v\n", i, x[i], i, y[i])
    24  		}
    25  	}
    26  }
    27  

View as plain text