mirror of
https://github.com/golang/go
synced 2024-11-08 19:26:14 -07:00
67722fea50
Apply static bounds checking logic during type checking even to zero-element arrays, but skip synthesized OINDEX nodes that the compiler has asserted are within bounds (such as the ones generated while desugaring ORANGE nodes). This matches the logic in walkexpr that also skips static bounds checking when Bounded is true. Passes toolstash/buildall. Fixes #12944. Change-Id: I14ba03d71c002bf969d69783bec8d1a8e10e7d75 Reviewed-on: https://go-review.googlesource.com/15902 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
14 lines
274 B
Go
14 lines
274 B
Go
// errorcheck
|
|
|
|
// Copyright 2015 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
|
|
|
|
import "unsafe"
|
|
|
|
const (
|
|
_ = unsafe.Sizeof([0]byte{}[0]) // ERROR "out of bounds"
|
|
)
|