Source file
test/fixedbugs/issue68227.go
1
2
3
4
5
6
7 package main
8
9 import (
10 "fmt"
11 )
12
13 type someType []uint64
14
15 func (s *someType) push(v uint64) {
16 *s = append(*s, v)
17 }
18
19 func (s *someType) problematicFn(x1Lo, x1Hi, x2Lo, x2Hi uint64) {
20 r1 := int32(int16(x1Lo>>0)) * int32(int16(x2Lo>>0))
21 g()
22 r3 := int32(int16(x1Lo>>32)) * int32(int16(x2Lo>>32))
23 r4 := int32(int16(x1Lo>>48)) * int32(int16(x2Lo>>48))
24 r5 := int32(int16(x1Hi>>0)) * int32(int16(x2Hi>>0))
25 r7 := int32(int16(x1Hi>>32)) * int32(int16(x2Hi>>32))
26 r8 := int32(int16(x1Hi>>48)) * int32(int16(x2Hi>>48))
27 s.push(uint64(uint32(r1)) | (uint64(uint32(r3+r4)) << 32))
28 s.push(uint64(uint32(r5)) | (uint64(uint32(r7+r8)) << 32))
29 }
30
31
32 func g() {
33 }
34
35 func main() {
36 s := &someType{}
37 s.problematicFn(0x1000100010001, 0x1000100010001, 0xffffffffffffffff, 0xffffffffffffffff)
38 for i := 0; i < 2; i++ {
39 if got, want := (*s)[i], uint64(0xfffffffeffffffff); got != want {
40 fmt.Printf("s[%d]=%x, want %x\n", i, got, want)
41 }
42 }
43 }
44
View as plain text