...
Run Format

Source file test/fixedbugs/issue10486.go

Documentation: test/fixedbugs

     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  
    11  package main
    12  
    13  import "runtime"
    14  
    15  var A, B int
    16  
    17  func 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  
    28  func main() {
    29  	A = 1
    30  	divZero()
    31  }
    32  

View as plain text