...
Run Format

Source file test/fixedbugs/issue11987.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 11987. The ppc64 SRADCC instruction was misassembled in a way
     8  // lost bit 5 of the immediate so v>>32 was assembled as v>>0.  SRADCC
     9  // is only ever inserted by peep so it's hard to be sure when it will
    10  // be used. This formulation worked when the bug was fixed.
    11  
    12  package main
    13  
    14  import "fmt"
    15  
    16  var v int64 = 0x80000000
    17  
    18  func main() {
    19  	s := fmt.Sprintf("%v", v>>32 == 0)
    20  	if s != "true" {
    21  		fmt.Printf("BUG: v>>32 == 0 evaluated as %q\n", s)
    22  	}
    23  }
    24  

View as plain text