diff options
author | Rémy Oudompheng <oudomphe@phare.normalesup.org> | 2012-10-16 07:22:33 +0200 |
---|---|---|
committer | Rémy Oudompheng <oudomphe@phare.normalesup.org> | 2012-10-16 07:22:33 +0200 |
commit | 7e144bcab0df7efa7255ecfa1ac425931902437f (patch) | |
tree | bbfc330f240ff5d02c8237ea4194bc87094dbd38 /test/torture.go | |
parent | bcf88de5ffa1119e8b56a765a076d6a302ae3ecc (diff) | |
download | go-7e144bcab0df7efa7255ecfa1ac425931902437f.tar.gz go-7e144bcab0df7efa7255ecfa1ac425931902437f.zip |
cmd/5g, cmd/6g, cmd/8g: fix out of registers.
This patch is enough to fix compilation of
exp/types tests but only passes a stripped down
version of the appripriate torture test.
Update #4207.
R=dave, nigeltao, rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6621061
Diffstat (limited to 'test/torture.go')
-rw-r--r-- | test/torture.go | 76 |
1 files changed, 72 insertions, 4 deletions
diff --git a/test/torture.go b/test/torture.go index dd8ff59a03..60870c3f47 100644 --- a/test/torture.go +++ b/test/torture.go @@ -170,6 +170,74 @@ func ChainUNoAssert(u *U) *U { Child(0).(*U) } +// Type assertions and slice indexing. See issue 4207. +func ChainAssertIndex(u *U) J { + return u. + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0].(*U). + Children[0] +} + +type UArr struct { + Children [2]J +} + +func (u *UArr) Child(n int) J { return u.Children[n] } + +func ChainAssertArrayIndex(u *UArr) J { + return u. + Children[0].(*UArr). + Children[0].(*UArr). + Children[0].(*UArr). + Children[0].(*UArr). + Children[0].(*UArr). + Children[0].(*UArr). + Children[0].(*UArr). + // Children[0].(*UArr). + // Children[0].(*UArr). + // Children[0].(*UArr). + // Children[0].(*UArr). + // Children[0].(*UArr). + // Children[0].(*UArr). + Children[0] +} + +type UArrPtr struct { + Children *[2]J +} + +func (u *UArrPtr) Child(n int) J { return u.Children[n] } + +func ChainAssertArrayptrIndex(u *UArrPtr) J { + // TODO: don't crash on longer chains. + return u. + Children[0].(*UArrPtr). + Children[0].(*UArrPtr). + Children[0].(*UArrPtr). + Children[0].(*UArrPtr). + // Children[0].(*UArrPtr). + // Children[0].(*UArrPtr). + // Children[0].(*UArrPtr). + // Children[0].(*UArrPtr). + // Children[0].(*UArrPtr). + // Children[0].(*UArrPtr). + // Children[0].(*UArrPtr). + // Children[0].(*UArrPtr). + // Children[0].(*UArrPtr). + Children[0] +} + // Chains of divisions. See issue 4201. func ChainDiv(a, b int) int { @@ -180,10 +248,10 @@ func ChainDiv(a, b int) int { func ChainDivRight(a, b int) int { return a / (b / (a / (b / - (a / (b / (a / (b / - (a / (b / (a / (b / - (a / (b / (a / (b / - (a / (b / (a / b)))))))))))))))))) + (a / (b / (a / (b / + (a / (b / (a / (b / + (a / (b / (a / (b / + (a / (b / (a / b)))))))))))))))))) } func ChainDivConst(a int) int { |