1// run
2
3// Copyright 2015 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 10486.
8// Check stack walk during div by zero fault,
9// especially on software divide systems.
10
11package main
12
13import "runtime"
14
15var A, B int
16
17func divZero() int {
18	defer func() {
19		if p := recover(); p != nil {
20			var pcs [512]uintptr
21			runtime.Callers(2, pcs[:])
22			runtime.GC()
23		}
24	}()
25	return A / B
26}
27
28func main() {
29	A = 1
30	divZero()
31}
32