Source file test/fixedbugs/bug456.go

     1  // run
     2  
     3  // Copyright 2012 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  // 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  }
    27  

View as plain text