Source file test/fixedbugs/issue30061.go

     1  // compile
     2  
     3  // Copyright 2019 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 we can linkname to memmove with an unsafe.Pointer argument.
     8  
     9  package p
    10  
    11  import "unsafe"
    12  
    13  //go:linkname memmove runtime.memmove
    14  func memmove(to, from unsafe.Pointer, n uintptr)
    15  
    16  var V1, V2 int
    17  
    18  func F() {
    19  	memmove(unsafe.Pointer(&V1), unsafe.Pointer(&V2), unsafe.Sizeof(int(0)))
    20  }
    21  

View as plain text