...
Run Format

Source file test/fixedbugs/issue11286.go

Documentation: test/fixedbugs

     1  // run
     2  
     3  // Copyright 2015 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  // Test that pointer bitmaps of types with large scalar tails are
     8  // correctly repeated when unrolled into the heap bitmap.
     9  
    10  package main
    11  
    12  import "runtime"
    13  
    14  const D = 57
    15  
    16  type T struct {
    17  	a [D]float64
    18  	b map[string]int
    19  	c [D]float64
    20  }
    21  
    22  var ts []T
    23  
    24  func main() {
    25  	ts = make([]T, 4)
    26  	for i := range ts {
    27  		ts[i].b = make(map[string]int)
    28  	}
    29  	ts[3].b["abc"] = 42
    30  	runtime.GC()
    31  	if ts[3].b["abc"] != 42 {
    32  		panic("bad field value")
    33  	}
    34  }
    35  

View as plain text