Source file test/codegen/race.go

     1  // asmcheck -race
     2  
     3  // Copyright 2019 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  package codegen
     8  
     9  // Check that we elide racefuncenter/racefuncexit for
    10  // functions with no calls (but which might panic
    11  // in various ways). See issue 31219.
    12  // amd64:-"CALL.*racefuncenter.*"
    13  // arm64:-"CALL.*racefuncenter.*"
    14  // ppc64le:-"CALL.*racefuncenter.*"
    15  func RaceMightPanic(a []int, i, j, k, s int) {
    16  	var b [4]int
    17  	_ = b[i]     // panicIndex
    18  	_ = a[i:j]   // panicSlice
    19  	_ = a[i:j:k] // also panicSlice
    20  	_ = i << s   // panicShift
    21  	_ = i / j    // panicDivide
    22  }
    23  

View as plain text