1// run 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 51101: on RISCV64, difference of two pointers 8// was marked as pointer and crashes GC. 9 10package main 11 12var a, b int 13 14func main() { 15 F(&b, &a) 16} 17 18//go:noinline 19func F(a, b *int) bool { 20 x := a == b 21 G(x) 22 y := a != b 23 return y 24} 25 26//go:noinline 27func G(bool) { 28 grow([1000]int{20}) 29} 30 31func grow(x [1000]int) { 32 if x[0] != 0 { 33 x[0]-- 34 grow(x) 35 } 36} 37