Home | History | Annotate | Download | only in issue5291.dir
      1 // Copyright 2013 The Go Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style
      3 // license that can be found in the LICENSE file.
      4 
      5 package pkg1
      6 
      7 import (
      8 	"runtime"
      9 )
     10 
     11 type T2 *[]string
     12 
     13 type Data struct {
     14 	T1 *[]T2
     15 }
     16 
     17 func CrashCall() (err error) {
     18 	var d Data
     19 
     20 	for count := 0; count < 10; count++ {
     21 		runtime.GC()
     22 
     23 		len := 2 // crash when >=2
     24 		x := make([]T2, len)
     25 
     26 		d = Data{T1: &x}
     27 
     28 		for j := 0; j < len; j++ {
     29 			y := make([]string, 1)
     30 			(*d.T1)[j] = &y
     31 		}
     32 	}
     33 	return nil
     34 }
     35