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:
parent
5ff7d84892
commit
7472f4c951
@ -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
18
test/fixedbugs/bug168.go
Normal 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]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user