test/fixedbugs/issue4353.go
raw| 1 | // run |
| 2 | |
| 3 | // Copyright 2012 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 | // Issue 4353. An optimizer bug in 8g triggers a runtime fault |
| 8 | // instead of an out of bounds panic. |
| 9 | |
| 10 | package main |
| 11 | |
| 12 | var aib [100000]int |
| 13 | var paib *[100000]int = &aib |
| 14 | var i64 int64 = 100023 |
| 15 | |
| 16 | func main() { |
| 17 | defer func() { recover() }() |
| 18 | _ = paib[i64] |
| 19 | } |