diff options
author | Alberto Donizetti <alb.donizetti@gmail.com> | 2020-10-01 12:03:27 +0200 |
---|---|---|
committer | Alberto Donizetti <alb.donizetti@gmail.com> | 2020-10-03 13:02:20 +0000 |
commit | 095e0f48a19fa3bd7901f79420374b9cb50940e9 (patch) | |
tree | a60e196b1aaa8389f248bea1812c212d53febc63 /test | |
parent | f89d05eb7ba1885474d03bb62f0a36a2d3cf56ea (diff) | |
download | go-095e0f48a19fa3bd7901f79420374b9cb50940e9.tar.gz go-095e0f48a19fa3bd7901f79420374b9cb50940e9.zip |
cmd/compile: change mustHeapAlloc to return a reason why
This change renames mustHeapAlloc to heapAllocReason, and changes it
to return the reason why the argument must escape, so we don't have to
re-deduce it in its callers just to print the escape reason. It also
embeds isSmallMakeSlice body in heapAllocReason, since the former was
only used by the latter, and deletes isSmallMakeSlice.
An outdated TODO to remove smallintconst, which the TODO claimed was
only used in one place, was also removed, since grepping shows we
currently call smallintconst in 11 different places.
Change-Id: I0bd11bf29b92c4126f5bb455877ff73217d5a155
Reviewed-on: https://go-review.googlesource.com/c/go/+/258678
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/fixedbugs/issue41635.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/fixedbugs/issue41635.go b/test/fixedbugs/issue41635.go index b33c1a07e7..35c0034cdd 100644 --- a/test/fixedbugs/issue41635.go +++ b/test/fixedbugs/issue41635.go @@ -7,12 +7,11 @@ package p func f() { // ERROR "" - b1 := make([]byte, 1<<17) // ERROR "too large for stack" "" - b2 := make([]byte, 100, 1<<17) // ERROR "too large for stack" "" - n, m := 100, 200 - b1 = make([]byte, n) // ERROR "non-constant size" "" - b2 = make([]byte, 100, m) // ERROR "non-constant size" "" + _ = make([]byte, 1<<17) // ERROR "too large for stack" "" + _ = make([]byte, 100, 1<<17) // ERROR "too large for stack" "" + _ = make([]byte, n, 1<<17) // ERROR "too large for stack" "" - _, _ = b1, b2 + _ = make([]byte, n) // ERROR "non-constant size" "" + _ = make([]byte, 100, m) // ERROR "non-constant size" "" } |