Files
garble/testdata/script/atomic.txtar
Daniel Martí 30357af923 drop Go 1.22 and require Go 1.23.0 or later (#876)
This lets us start taking advantage of featurs from Go 1.23,
particularly tracking aliases in go/types and iterators.

Note that we need to add code to properly handle or skip over the new
*types.Alias type which go/types produces for Go type aliases.
Also note that we actually turn this mode off entirely for now,
due to the bug reported at https://go.dev/issue/70394.

We don't yet remove our own alias tracking code yet due to the above.
We hope to be able to remove it very soon.
2024-11-17 16:06:57 +01:00

52 lines
992 B
Plaintext

# amd64 can typically run 386 programs,
# which is handy to actually make this test useful.
# We assume that the same applies to arm64.
# Note that darwin is an exception compared to linux and windows,
# as darwin/386 and darwin/arm are not supported.
[amd64] [!darwin] env GOARCH=386
[arm64] [!darwin] env GOARCH=arm
exec garble build
exec ./main
cmp stderr main.stderr
[short] stop # no need to verify this with -short
go build
exec ./main
cmp stderr main.stderr
-- go.mod --
module test/main
go 1.23
-- main.go --
package main
import (
"sync"
"sync/atomic"
)
var unalignedUint64 struct {
// If sync/atomic's support in the compiler is broken,
// then u64 is not aligned to 64 bits on 32-bit platforms,
// and that may cause a panic.
_ bool
u64 atomic.Uint64
}
func main() {
var wg sync.WaitGroup
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
unalignedUint64.u64.Add(2)
wg.Done()
}()
}
wg.Wait()
println(unalignedUint64.u64.Load())
}
-- main.stderr --
20