Source file test/fixedbugs/issue29402.go

     1  // run
     2  
     3  // Copyright 2018 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 29402: wrong optimization of comparison of
     8  // constant and shift on MIPS.
     9  
    10  package main
    11  
    12  //go:noinline
    13  func F(s []int) bool {
    14  	half := len(s) / 2
    15  	return half >= 0
    16  }
    17  
    18  func main() {
    19  	b := F([]int{1, 2, 3, 4})
    20  	if !b {
    21  		panic("FAIL")
    22  	}
    23  }
    24  

View as plain text