mirror of
https://github.com/golang/go
synced 2024-11-18 14:44:41 -07:00
c9c64886ef
We never supported symbol larger than 2GB (issue #9862), so the object file uses 32-bit for symbol sizes. Check and reject too large symbol before truncating its size. Fixes #42054. Change-Id: I0d1d585ebdba9556f2fd3a97043bd4296d5cc9e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/263641 Trust: Cherry Zhang <cherryyz@google.com> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org>
32 lines
584 B
Go
32 lines
584 B
Go
// skip
|
|
|
|
// Copyright 2012 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.
|
|
|
|
// Issue 4348. After switch to 64-bit ints the compiler generates
|
|
// illegal instructions when using large array bounds or indexes.
|
|
|
|
// Skip. We reject symbols larger that 2GB (Issue #9862).
|
|
|
|
package main
|
|
|
|
// 1<<32 on a 64-bit machine, 1 otherwise.
|
|
const LARGE = ^uint(0)>>32 + 1
|
|
|
|
func A() int {
|
|
var a []int
|
|
return a[LARGE]
|
|
}
|
|
|
|
var b [LARGE]int
|
|
|
|
func B(i int) int {
|
|
return b[i]
|
|
}
|
|
|
|
func main() {
|
|
n := A()
|
|
B(n)
|
|
}
|