What version of Go are you using (go version)?
devel +fd41951
What operating system and processor architecture are you using (go env)?
AMD64 Linux
What did you do?
Compile and run this program:
package main
import "sync/atomic"
var count uint32
func main() {
buffer := []byte("T")
for i := 0; i < len(buffer); {
atomic.AddUint32(&count, 1)
_ = buffer[i]
i++
i++
}
}
What did you expect to see?
No output. This is what happens in Go 1.7.
What did you see instead?
panic: runtime error: index out of range
goroutine 1 [running]:
panic(0x458f40, 0xc42000a150)
/go/src/runtime/panic.go:500 +0x1a0
main.main()
inc_panic_example/main.go:11 +0x76
What version of Go are you using (
go version)?devel +fd41951
What operating system and processor architecture are you using (
go env)?AMD64 Linux
What did you do?
Compile and run this program:
What did you expect to see?
No output. This is what happens in Go 1.7.
What did you see instead?