File: issue67160.go

package info (click to toggle)
golang-1.23 1.23.5-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 157,540 kB
  • sloc: asm: 127,587; ansic: 6,971; sh: 2,218; javascript: 1,664; perl: 1,052; python: 366; makefile: 88; cpp: 39; f90: 8; awk: 7; objc: 4
file content (32 lines) | stat: -rw-r--r-- 767 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// run

// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Test to make sure that we don't try using larger loads for
// generated equality functions on architectures that can't do
// unaligned loads.

package main

// T has a big field that wants to be compared with larger loads/stores.
// T is "special" because of the unnamed field, so it needs a generated equality function.
// T is an odd number of bytes in size and has alignment 1.
type T struct {
	src [8]byte
	_   byte
}

// U contains 8 copies of T, each at a different %8 alignment.
type U [8]T

//go:noinline
func f(x, y *U) bool {
	return *x == *y
}

func main() {
	var a U
	_ = f(&a, &a)
}