mirror of
https://github.com/golang/go
synced 2025-04-15 00:35:44 +00:00
... if the architecture can't do unaligned loads. We already handle this in a few places, but this particular place was added in CL 399542 and missed this additional restriction. Fixes #67212 (Reroll of CL 583417) Change-Id: I8ee74909341e0af0d51d3761e17ff92e744ecd38 Reviewed-on: https://go-review.googlesource.com/c/go/+/583798 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
33 lines
767 B
Go
33 lines
767 B
Go
// 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)
|
|
}
|