diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/fixedbugs/issue65593.go | 21 | ||||
-rw-r--r-- | test/fixedbugs/issue66066.go | 41 | ||||
-rw-r--r-- | test/fixedbugs/issue66066b.go | 58 | ||||
-rw-r--r-- | test/fixedbugs/issue66096.go | 17 |
4 files changed, 137 insertions, 0 deletions
diff --git a/test/fixedbugs/issue65593.go b/test/fixedbugs/issue65593.go new file mode 100644 index 0000000..892a781 --- /dev/null +++ b/test/fixedbugs/issue65593.go @@ -0,0 +1,21 @@ +// compile + +// 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. + +package p + +const run = false + +func f() { + if !run { + return + } + + messages := make(chan struct{}, 1) +main: + for range messages { + break main + } +} diff --git a/test/fixedbugs/issue66066.go b/test/fixedbugs/issue66066.go new file mode 100644 index 0000000..a674503 --- /dev/null +++ b/test/fixedbugs/issue66066.go @@ -0,0 +1,41 @@ +// 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. + +package main + +import "fmt" + +func main() { + testMod() + testMul() +} + +//go:noinline +func mod3(x uint32) uint64 { + return uint64(x % 3) +} + +func testMod() { + got := mod3(1<<32 - 1) + want := uint64((1<<32 - 1) % 3) + if got != want { + fmt.Printf("testMod: got %x want %x\n", got, want) + } + +} + +//go:noinline +func mul3(a uint32) uint64 { + return uint64(a * 3) +} + +func testMul() { + got := mul3(1<<32 - 1) + want := uint64((1<<32-1)*3 - 2<<32) + if got != want { + fmt.Printf("testMul: got %x want %x\n", got, want) + } +} diff --git a/test/fixedbugs/issue66066b.go b/test/fixedbugs/issue66066b.go new file mode 100644 index 0000000..7540a85 --- /dev/null +++ b/test/fixedbugs/issue66066b.go @@ -0,0 +1,58 @@ +// 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. + +package main + +//go:noinline +func f32(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x int32) uint64 { + return uint64(uint32(x)) +} + +//go:noinline +func f16(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x int16) uint64 { + return uint64(uint16(x)) +} + +//go:noinline +func f8(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x int8) uint64 { + return uint64(uint8(x)) +} + +//go:noinline +func g32(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x uint32) int64 { + return int64(int32(x)) +} + +//go:noinline +func g16(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x uint16) int64 { + return int64(int16(x)) +} + +//go:noinline +func g8(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x uint8) int64 { + return int64(int8(x)) +} + +func main() { + if got := f32(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1); got != 0xffffffff { + println("bad f32", got) + } + if got := f16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1); got != 0xffff { + println("bad f16", got) + } + if got := f8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1); got != 0xff { + println("bad f8", got) + } + if got := g32(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xffffffff); got != -1 { + println("bad g32", got) + } + if got := g16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xffff); got != -1 { + println("bad g16", got) + } + if got := g8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff); got != -1 { + println("bad g8", got) + } +} diff --git a/test/fixedbugs/issue66096.go b/test/fixedbugs/issue66096.go new file mode 100644 index 0000000..f8621a1 --- /dev/null +++ b/test/fixedbugs/issue66096.go @@ -0,0 +1,17 @@ +// compile + +// 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. + +package p + +type Message struct { + Header map[string][]string +} + +func f() { + m := Message{Header: map[string][]string{}} + m.Header[""] = append([]string(m.Header[""]), "") + _ = m +} |