aboutsummaryrefslogtreecommitdiff
path: root/test/fixedbugs/issue51101.go
blob: a390e50da4060dc697701efb8cd4e7eded738546 (plain)
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
// run

// Copyright 2022 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.

// Issue 51101: on RISCV64, difference of two pointers
// was marked as pointer and crashes GC.

package main

var a, b int

func main() {
	F(&b, &a)
}

//go:noinline
func F(a, b *int) bool {
	x := a == b
	G(x)
	y := a != b
	return y
}

//go:noinline
func G(bool) {
	grow([1000]int{20})
}

func grow(x [1000]int) {
	if x[0] != 0 {
		x[0]--
		grow(x)
	}
}