Debian Codegraph @

test/fixedbugs/issue66066b.go

raw
1 // run
2
3 // Copyright 2024 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 package main
8
9 //go:noinline
10 func f32(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x int32) uint64 {
11 return uint64(uint32(x))
12 }
13
14 //go:noinline
15 func f16(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x int16) uint64 {
16 return uint64(uint16(x))
17 }
18
19 //go:noinline
20 func f8(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x int8) uint64 {
21 return uint64(uint8(x))
22 }
23
24 //go:noinline
25 func g32(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x uint32) int64 {
26 return int64(int32(x))
27 }
28
29 //go:noinline
30 func g16(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x uint16) int64 {
31 return int64(int16(x))
32 }
33
34 //go:noinline
35 func g8(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, x uint8) int64 {
36 return int64(int8(x))
37 }
38
39 func main() {
40 if got := f32(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1); got != 0xffffffff {
41 println("bad f32", got)
42 }
43 if got := f16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1); got != 0xffff {
44 println("bad f16", got)
45 }
46 if got := f8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1); got != 0xff {
47 println("bad f8", got)
48 }
49 if got := g32(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xffffffff); got != -1 {
50 println("bad g32", got)
51 }
52 if got := g16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xffff); got != -1 {
53 println("bad g16", got)
54 }
55 if got := g8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff); got != -1 {
56 println("bad g8", got)
57 }
58 }