modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue6036.go (about)

     1  // +build !386,!arm,!mips,!mipsle,!amd64p32
     2  // compile
     3  
     4  // Copyright 2013 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  // Issue 6036: 6g's backend generates OINDREG with
     9  // offsets larger than 32-bit.
    10  
    11  package main
    12  
    13  type T struct {
    14  	Large [1 << 31]byte
    15  	A     int
    16  	B     int
    17  }
    18  
    19  func F(t *T) {
    20  	t.B = t.A
    21  }
    22  
    23  type T2 [1<<31 + 2]byte
    24  
    25  func F2(t *T2) {
    26  	t[1<<31+1] = 42
    27  }
    28  
    29  type T3 [1<<15 + 1][1<<15 + 1]int
    30  
    31  func F3(t *T3) {
    32  	t[1<<15][1<<15] = 42
    33  }
    34  
    35  type S struct {
    36  	A int32
    37  	B int32
    38  }
    39  
    40  type T4 [1<<29 + 1]S
    41  
    42  func F4(t *T4) {
    43  	t[1<<29].B = 42
    44  }