1
0
mirror of https://github.com/golang/go synced 2024-11-25 09:27:57 -07:00
go/test/abi/bad_internal_offsets.go
Dmitri Shuralyov b2fd76ab8d test: migrate remaining files to go:build syntax
Most of the test cases in the test directory use the new go:build syntax
already. Convert the rest. In general, try to place the build constraint
line below the test directive comment in more places.

For #41184.
For #60268.

Change-Id: I11c41a0642a8a26dc2eda1406da908645bbc005b
Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest,gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/536236
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-10-19 23:33:25 +00:00

74 lines
1.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// compile
//go:build !wasm
// Copyright 2021 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.
package genChecker0
var FailCount int
//go:noinline
func NoteFailure(fidx int, pkg string, pref string, parmNo int, _ uint64) {
FailCount += 1
if FailCount > 10 {
panic("bad")
}
}
//go:noinline
func NoteFailureElem(fidx int, pkg string, pref string, parmNo int, elem int, _ uint64) {
FailCount += 1
if FailCount > 10 {
panic("bad")
}
}
type StructF0S0 struct {
F0 int16
F1 string
F2 StructF0S1
}
type StructF0S1 struct {
_ uint16
}
// 0 returns 3 params
//go:registerparams
//go:noinline
func Test0(p0 uint32, p1 StructF0S0, p2 int32) {
// consume some stack space, so as to trigger morestack
var pad [256]uint64
pad[FailCount]++
if p0 == 0 {
return
}
p1f0c := int16(-3096)
if p1.F0 != p1f0c {
NoteFailureElem(0, "genChecker0", "parm", 1, 0, pad[0])
return
}
p1f1c := "f6ꂅ8ˋ<"
if p1.F1 != p1f1c {
NoteFailureElem(0, "genChecker0", "parm", 1, 1, pad[0])
return
}
p1f2c := StructF0S1{}
if p1.F2 != p1f2c {
NoteFailureElem(0, "genChecker0", "parm", 1, 2, pad[0])
return
}
p2f0c := int32(496713155)
if p2 != p2f0c {
NoteFailureElem(0, "genChecker0", "parm", 2, 0, pad[0])
return
}
// recursive call
Test0(p0-1, p1, p2)
return
// 0 addr-taken params, 0 addr-taken returns
}