Commit 42426ed4 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: Fatal instead of panic in large bvbulkalloc

This provides better diagnostics when it occurs.

Updates #19751

Change-Id: I87db54c22e1345891b418c1741dc76ac5fb8ed00
Reviewed-on: https://go-review.googlesource.com/39358
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 094498c9
...@@ -29,8 +29,12 @@ type bulkBvec struct { ...@@ -29,8 +29,12 @@ type bulkBvec struct {
func bvbulkalloc(nbit int32, count int32) bulkBvec { func bvbulkalloc(nbit int32, count int32) bulkBvec {
nword := (nbit + WORDBITS - 1) / WORDBITS nword := (nbit + WORDBITS - 1) / WORDBITS
size := int64(nword) * int64(count)
if int64(int32(size*4)) != size*4 {
Fatalf("bvbulkalloc too big: nbit=%d count=%d nword=%d size=%d", nbit, count, nword, size)
}
return bulkBvec{ return bulkBvec{
words: make([]uint32, nword*count), words: make([]uint32, size),
nbit: nbit, nbit: nbit,
nword: nword, nword: nword,
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment