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// Test that the half multiply resulting from a division 8// by a constant generates correct code. 9 10package main 11 12func main() { 13 var _ = 7 / "0"[0] // test case from #11369 14 var _ = 1 / "."[0] // test case from #11358 15 var x = 0 / "0"[0] 16 var y = 48 / "0"[0] 17 var z = 5 * 48 / "0"[0] 18 if x != 0 { 19 panic("expected 0") 20 } 21 if y != 1 { 22 panic("expected 1") 23 } 24 if z != 5 { 25 panic("expected 5") 26 } 27} 28