Source file test/fixedbugs/issue54638.go

     1  // compile
     2  
     3  // Copyright 2022 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 54638: composite literal assignment with
     8  // alignment > PtrSize causes ICE.
     9  
    10  package p
    11  
    12  import "sync/atomic"
    13  
    14  type S struct{ l any }
    15  
    16  type T struct {
    17  	H any
    18  	a [14]int64
    19  	f func()
    20  	x atomic.Int64
    21  }
    22  
    23  //go:noinline
    24  func (T) M(any) {}
    25  
    26  type W [2]int64
    27  
    28  //go:noinline
    29  func (W) Done() {}
    30  
    31  func F(l any) [3]*int {
    32  	var w W
    33  	var x [3]*int // use some stack
    34  	t := T{H: S{l: l}}
    35  	go func() {
    36  		t.M(l)
    37  		w.Done()
    38  	}()
    39  	return x
    40  }
    41  

View as plain text