mirror of
https://github.com/golang/go.git
synced 2025-05-29 11:25:43 +00:00
64-bit integer math bugs
R=r DELTA=46 (46 added, 0 deleted, 0 changed) OCL=29569 CL=29614
This commit is contained in:
parent
3b37b02834
commit
cc7c31baa4
23
test/bugs/bug155.go
Normal file
23
test/bugs/bug155.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// $G $D/$F.go && $L $F.$A || echo BUG: bug155
|
||||||
|
|
||||||
|
// Copyright 2009 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
|
||||||
|
|
||||||
|
const big uint64 = 1<<63
|
||||||
|
|
||||||
|
func f(a uint64) uint64 {
|
||||||
|
return a << big
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
f(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
main·f: doasm: notfound from=75 to=13 (82) SHLQ $-9223372036854775808,BX
|
||||||
|
main·f: doasm: notfound from=75 to=13 (82) SHLQ $-9223372036854775808,BX
|
||||||
|
main·f: doasm: notfound from=75 to=13 (82) SHLQ $-9223372036854775808,BX
|
||||||
|
*/
|
21
test/bugs/bug156.go
Normal file
21
test/bugs/bug156.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// $G $D/$F.go || echo BUG: bug156
|
||||||
|
|
||||||
|
// Copyright 2009 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
|
||||||
|
|
||||||
|
func f(a int64) int64 {
|
||||||
|
const b int64 = 0;
|
||||||
|
n := a &^ b;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
f(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
bug156.go:7: constant 18446744073709551615 overflows int64
|
||||||
|
*/
|
@ -104,6 +104,16 @@ BUG should compile
|
|||||||
5 7
|
5 7
|
||||||
BUG: should crash
|
BUG: should crash
|
||||||
|
|
||||||
|
=========== bugs/bug155.go
|
||||||
|
main·f: doasm: notfound from=75 to=13 (82) SHLQ $-9223372036854775808,BX
|
||||||
|
main·f: doasm: notfound from=75 to=13 (82) SHLQ $-9223372036854775808,BX
|
||||||
|
main·f: doasm: notfound from=75 to=13 (82) SHLQ $-9223372036854775808,BX
|
||||||
|
BUG: bug155
|
||||||
|
|
||||||
|
=========== bugs/bug156.go
|
||||||
|
bugs/bug156.go:7: constant 18446744073709551615 overflows int64
|
||||||
|
BUG: bug156
|
||||||
|
|
||||||
=========== fixedbugs/bug016.go
|
=========== fixedbugs/bug016.go
|
||||||
fixedbugs/bug016.go:7: constant -3 overflows uint
|
fixedbugs/bug016.go:7: constant -3 overflows uint
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user