Source file test/fixedbugs/issue67160.go

     1  // run
     2  
     3  // Copyright 2024 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 to make sure that we don't try using larger loads for
     8  // generated equality functions on architectures that can't do
     9  // unaligned loads.
    10  
    11  package main
    12  
    13  // T has a big field that wants to be compared with larger loads/stores.
    14  // T is "special" because of the unnamed field, so it needs a generated equality function.
    15  // T is an odd number of bytes in size and has alignment 1.
    16  type T struct {
    17  	src [8]byte
    18  	_   byte
    19  }
    20  
    21  // U contains 8 copies of T, each at a different %8 alignment.
    22  type U [8]T
    23  
    24  //go:noinline
    25  func f(x, y *U) bool {
    26  	return *x == *y
    27  }
    28  
    29  func main() {
    30  	var a U
    31  	_ = f(&a, &a)
    32  }
    33  

View as plain text