Source file test/fixedbugs/walk_bounded_overshift_empty_bound.go
1 // run 2 3 // Copyright 2026 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 import "strings" 10 11 //go:noinline 12 func f(i uint8) byte { 13 return ""[i>>9] 14 } 15 16 func main() { 17 defer func() { 18 r := recover() 19 if r == nil { 20 panic("missing bounds panic") 21 } 22 if got := r.(error).Error(); !strings.Contains(got, "index out of range") { 23 panic(got) 24 } 25 }() 26 _ = f(7) 27 } 28