Source file test/fixedbugs/bug440_64.go

     1  // run
     2  
     3  // Test for 6g register move bug.  The optimizer gets confused
     4  // about 32- vs 64-bit moves during splitContractIndex.
     5  
     6  // Issue 3918.
     7  
     8  package main
     9  
    10  func main() {
    11  	const c = 0x123400005678
    12  	index, offset := splitContractIndex(c)
    13  	if index != (c&0xffffffff)>>5 || offset != c+1 {
    14  		println("BUG", index, offset)
    15  	}
    16  }
    17  
    18  func splitContractIndex(ce uint64) (index uint32, offset uint64) {
    19  	h := uint32(ce)
    20  	return h >> 5, ce + 1
    21  }
    22  

View as plain text