Source file test/fixedbugs/issue4348.go

     1  // skip
     2  
     3  // Copyright 2012 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Issue 4348. After switch to 64-bit ints the compiler generates
     8  // illegal instructions when using large array bounds or indexes.
     9  
    10  // Skip. We reject symbols larger that 2GB (Issue #9862).
    11  
    12  package main
    13  
    14  // 1<<32 on a 64-bit machine, 1 otherwise.
    15  const LARGE = ^uint(0)>>32 + 1
    16  
    17  func A() int {
    18  	var a []int
    19  	return a[LARGE]
    20  }
    21  
    22  var b [LARGE]int
    23  
    24  func B(i int) int {
    25  	return b[i]
    26  }
    27  
    28  func main() {
    29  	n := A()
    30  	B(n)
    31  }
    32  

View as plain text