]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix checkptr false positive for (*[Big]T)(ptr)[:n:n] pattern
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 20 Aug 2021 04:38:54 +0000 (11:38 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 25 Aug 2021 01:57:42 +0000 (01:57 +0000)
commitde1c934b9709728b15cc821a055155ee13e1d0ab
treee755f419c10b85990e9336958d2aa2e4ae3ac326
parent54cdef1f101a7a15fa6412fbedf8b009a1f725a1
cmd/compile: fix checkptr false positive for (*[Big]T)(ptr)[:n:n] pattern

The checkptr instrumentation is currently inserted before slice
operation has validated that n <= Big. So instead of panic, checkptr
have false positive throws.

To fix this, just insert the checkptr instrumentation after the bound
checking during SSA generation.

Fixes #46938

Change-Id: I9dbf84441c711842ccc883f3654ca8766ac696d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/343972
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/ssagen/ssa.go
src/cmd/compile/internal/walk/convert.go
src/cmd/compile/internal/walk/expr.go
test/fixedbugs/issue46938.go [new file with mode: 0644]