Source file test/fixedbugs/issue79886.go

     1  // run
     2  
     3  // Copyright 2026 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 main
     8  
     9  import (
    10  	"fmt"
    11  )
    12  
    13  //go:noinline
    14  func shifted(x int64, y uint64) int64 {
    15  	return x >> uint32(y)
    16  }
    17  
    18  func main() {
    19  	x := int64(-0x4000000000000000)
    20  	got := shifted(x, ^uint64(0)&^(1<<32-2))
    21  	want := x >> 1
    22  	if got != want {
    23  		panic(fmt.Sprintf("want %d; got %d", want, got))
    24  	}
    25  }
    26  

View as plain text