1// run -gcflags=-d=ssa/check/on 2 3// Copyright 2019 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// As of 2019-06, bug affects/ed amd64 and s390x. 8 9package main 10 11var foo = []byte{105, 57, 172, 152} 12 13func main() { 14 for i := 0; i < len(foo); i += 4 { 15 // Requires inlining and non-constant i 16 // Note the bug/fix also apply to different widths, but was unable to reproduce for those. 17 println(readLittleEndian32_2(foo[i], foo[i+1], foo[i+2], foo[i+3])) 18 } 19} 20 21func readLittleEndian32_2(a, b, c, d byte) uint32 { 22 return uint32(a) | (uint32(b) << 8) | (uint32(c) << 16) | (uint32(d) << 24) 23} 24