0
1
mirror of https://github.com/golang/go synced 2025-08-07 01:11:44 +00:00
Files
go/test/live2.go
Michael Pratt 2ae059ccaf all: remove GOEXPERIMENT=swissmap
For #54766.

Change-Id: I6a6a636c40b5fe2e8b0d4a5e23933492bc8bb76e
Reviewed-on: https://go-review.googlesource.com/c/go/+/691595
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-30 11:47:14 -07:00

42 lines
979 B
Go

// errorcheck -0 -live -wb=0
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// liveness tests with inlining ENABLED
// see also live.go.
package main
// issue 8142: lost 'addrtaken' bit on inlined variables.
func printnl()
//go:noescape
func useT40(*T40)
type T40 struct {
m map[int]int
}
func newT40() *T40 {
ret := T40{}
ret.m = make(map[int]int, 42) // ERROR "live at call to makemap: &ret$"
return &ret
}
func bad40() {
t := newT40() // ERROR "stack object ret T40$" "stack object .autotmp_[0-9]+ internal/runtime/maps.Map$"
printnl() // ERROR "live at call to printnl: ret$"
useT40(t)
}
func good40() {
ret := T40{} // ERROR "stack object ret T40$"
ret.m = make(map[int]int, 42) // ERROR "stack object .autotmp_[0-9]+ internal/runtime/maps.Map$"
t := &ret
printnl() // ERROR "live at call to printnl: ret$"
useT40(t)
}