Rémy Oudompheng | 4bb75cd | 2012-09-30 10:35:09 +0200 | [diff] [blame] | 1 | // run |
| 2 | |
Emmanuel Odeke | 53fd522 | 2016-04-10 14:32:26 -0700 | [diff] [blame] | 3 | // Copyright 2012 The Go Authors. All rights reserved. |
Rémy Oudompheng | 4bb75cd | 2012-09-30 10:35:09 +0200 | [diff] [blame] | 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | // Issue 3907: out of fixed registers in nested byte multiply. |
| 8 | // Used to happen with both 6g and 8g. |
| 9 | |
| 10 | package main |
| 11 | |
| 12 | func F(a, b, c, d uint8) uint8 { |
| 13 | return a * (b * (c * (d * |
| 14 | (a * (b * (c * (d * |
| 15 | (a * (b * (c * (d * |
| 16 | a * (b * (c * d))))))))))))) |
| 17 | } |
| 18 | |
| 19 | func main() { |
| 20 | var a, b, c, d uint8 = 1, 1, 1, 1 |
| 21 | x := F(a, b, c, d) |
| 22 | if x != 1 { |
| 23 | println(x) |
| 24 | panic("x != 1") |
| 25 | } |
| 26 | } |