diff options
author | Rémy Oudompheng <oudomphe@phare.normalesup.org> | 2012-10-07 00:30:29 +0200 |
---|---|---|
committer | Rémy Oudompheng <oudomphe@phare.normalesup.org> | 2012-10-07 00:30:29 +0200 |
commit | 46fcfdaa7dc4c35cf593df2b883db28814e641fe (patch) | |
tree | 2da891419840f41bb56af5716ce6980f140072b2 /test/torture.go | |
parent | 94acfde22e73902692b8eef413c7c35a5ba98708 (diff) | |
download | go-46fcfdaa7dc4c35cf593df2b883db28814e641fe.tar.gz go-46fcfdaa7dc4c35cf593df2b883db28814e641fe.zip |
cmd/6g: fix out of registers when chaining integer divisions.
Fixes #4201.
R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6622055
Diffstat (limited to 'test/torture.go')
-rw-r--r-- | test/torture.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/torture.go b/test/torture.go index fdc5ddae0f..dd8ff59a03 100644 --- a/test/torture.go +++ b/test/torture.go @@ -169,3 +169,25 @@ func ChainUNoAssert(u *U) *U { Child(0). Child(0).(*U) } + +// Chains of divisions. See issue 4201. + +func ChainDiv(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 +} + +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)))))))))))))))))) +} + +func ChainDivConst(a int) int { + return a / 17 / 17 / 17 / + 17 / 17 / 17 / 17 / + 17 / 17 / 17 / 17 +} |