| Server IP : 92.112.183.76 / Your IP : 216.73.217.143 Web Server : LiteSpeed System : Linux lt-bnk-web922.main-hosting.eu 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64 User : u970350538 ( 970350538) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/golang/1.22.0/src/cmd/compile/internal/loopvar/testdata/ |
Upload File : |
// Copyright 2023 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.
package main
import (
"fmt"
"os"
)
var is []func() int
func inline(j, k int) []*int {
var a []*int
for private := j; private < k; private++ {
a = append(a, &private)
}
return a
}
//go:noinline
func notinline(j, k int) ([]*int, *int) {
for shared := j; shared < k; shared++ {
if shared == k/2 {
// want the call inlined, want "private" in that inline to be transformed,
// (believe it ends up on init node of the return).
// but do not want "shared" transformed,
return inline(j, k), &shared
}
}
return nil, &j
}
func main() {
a, p := notinline(2, 9)
fmt.Printf("a[0]=%d,*p=%d\n", *a[0], *p)
if *a[0] != 2 {
os.Exit(1)
}
}