...
Run Format

Source file test/fixedbugs/issue4348.go

Documentation: test/fixedbugs

     1  // compile
     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  package main
    11  
    12  // 1<<32 on a 64-bit machine, 1 otherwise.
    13  const LARGE = ^uint(0)>>32 + 1
    14  
    15  func A() int {
    16  	var a []int
    17  	return a[LARGE]
    18  }
    19  
    20  var b [LARGE]int
    21  
    22  func B(i int) int {
    23  	return b[i]
    24  }
    25  
    26  func main() {
    27  	n := A()
    28  	B(n)
    29  }
    30  

View as plain text