1
0
mirror of https://github.com/golang/go synced 2024-11-27 05:51:17 -07:00
go/test/fixedbugs/issue22200.go
Keith Randall e130dcf051 cmd/compile: abort earlier if stack frame too large
If the stack frame is too large, abort immediately.
We used to generate code first, then abort.
In issue 22200, generating code raised a panic
so we got an ICE instead of an error message.

Change the max frame size to 1GB (from 2GB).
Stack frames between 1.1GB and 2GB didn't used to work anyway,
the pcln table generation would have failed and generated an ICE.

Fixes #22200

Change-Id: I1d918ab27ba6ebf5c87ec65d1bccf973f8c8541e
Reviewed-on: https://go-review.googlesource.com/69810
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-11 18:24:13 +00:00

21 lines
393 B
Go

// errorcheck
// Copyright 2017 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 p
func f1(x *[1<<30 - 1e6]byte) byte {
for _, b := range *x {
return b
}
return 0
}
func f2(x *[1<<30 + 1e6]byte) byte { // ERROR "stack frame too large"
for _, b := range *x {
return b
}
return 0
}