1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:14:40 -07:00

bug168 (dsymonds) + fix

R=ken
OCL=31399
CL=31399
This commit is contained in:
Russ Cox 2009-07-09 12:08:50 -07:00
parent 5ff7d84892
commit 7472f4c951
2 changed files with 22 additions and 9 deletions

View File

@ -91,17 +91,12 @@ cgen(Node *n, Node *res)
// if both are not addressable, use a temporary. // if both are not addressable, use a temporary.
if(!n->addable && !res->addable) { if(!n->addable && !res->addable) {
if(is64(n->type)) { // could use regalloc here sometimes,
tempalloc(&n1, n->type); // but have to check for ullman >= UINF.
cgen(n, &n1); tempalloc(&n1, n->type);
cgen(&n1, res);
tempfree(&n1);
return;
}
regalloc(&n1, n->type, N);
cgen(n, &n1); cgen(n, &n1);
cgen(&n1, res); cgen(&n1, res);
regfree(&n1); tempfree(&n1);
return; return;
} }

18
test/fixedbugs/bug168.go Normal file
View File

@ -0,0 +1,18 @@
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug168
// Copyright 2009 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 byte = 123;
var f *byte = &g;
var b = make([]byte, 5);
func main() {
b[0:1][0] = *f;
if b[0] != 123 {
panic("want 123 got ", b[0]);
}
}