File: issue75569.go

package info (click to toggle)
golang-1.24 1.24.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 167,892 kB
  • sloc: asm: 154,904; ansic: 7,009; sh: 2,267; javascript: 1,705; perl: 1,052; python: 421; makefile: 110; cpp: 39; f90: 8; awk: 7; objc: 4
file content (77 lines) | stat: -rw-r--r-- 945 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// run

// Copyright 2025 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

func fff(a []int, b bool, p, q *int) {
outer:
	n := a[0]
	a = a[1:]
	switch n {
	case 1:
		goto one
	case 2:
		goto two
	case 3:
		goto three
	case 4:
		goto four
	}

one:
	goto inner
two:
	goto outer
three:
	goto inner
four:
	goto innerSideEntry

inner:
	n = a[0]
	a = a[1:]
	switch n {
	case 1:
		goto outer
	case 2:
		goto inner
	case 3:
		goto innerSideEntry
	default:
		return
	}
innerSideEntry:
	n = a[0]
	a = a[1:]
	switch n {
	case 1:
		goto outer
	case 2:
		goto inner
	case 3:
		goto inner
	}
	ggg(p, q)
	goto inner
}

var b bool

func ggg(p, q *int) {
	n := *p + 5 // this +5 ends up in the entry block, well before the *p load
	if b {
		*q = 0
	}
	*p = n
}

func main() {
	var x, y int
	fff([]int{4, 4, 4}, false, &x, &y)
	if x != 5 {
		panic(x)
	}
}