1
0
mirror of https://github.com/golang/go synced 2024-11-26 20:31:25 -07:00
go/test/fixedbugs/issue38746.go
Keith Randall b4ecafc986 cmd/compile: restrict bit test rewrite rules
The {AND,OR,XOR}const ops can only take an int32 as an argument.
Make sure that when rewriting a BTx op to one of these, the result
has no high-order bits.

Fixes #38746

Change-Id: Ia7c5f76952329f60974bc033c29a5433610f3b28
Reviewed-on: https://go-review.googlesource.com/c/go/+/231977
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2020-05-05 15:41:37 +00:00

18 lines
287 B
Go

// compile
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
var g *uint64
func main() {
var v uint64
g = &v
v &^= (1 << 31)
v |= 1 << 63
v &^= (1 << 63)
}