diff options
author | Rémy Oudompheng <oudomphe@phare.normalesup.org> | 2013-06-02 19:10:11 +0200 |
---|---|---|
committer | Rémy Oudompheng <oudomphe@phare.normalesup.org> | 2013-06-02 19:10:11 +0200 |
commit | 2c1acc18f42ffd2412e0e1b9acc04fbc5ea7c0aa (patch) | |
tree | 0652f87fe9bc74d67f39a60e33d9e6c9e507c0aa /test/sizeof.go | |
parent | 5b097e79511abb83ef04401140d7dab2b42c41a3 (diff) | |
download | go-2c1acc18f42ffd2412e0e1b9acc04fbc5ea7c0aa.tar.gz go-2c1acc18f42ffd2412e0e1b9acc04fbc5ea7c0aa.zip |
test: correct sizeof.go.
It would not pass on amd64 due to alignment of pointers.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9949043
Diffstat (limited to 'test/sizeof.go')
-rw-r--r-- | test/sizeof.go | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/test/sizeof.go b/test/sizeof.go index 9aa95677d4..c3db1e5c3a 100644 --- a/test/sizeof.go +++ b/test/sizeof.go @@ -1,4 +1,4 @@ -// compile +// run // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -58,35 +58,35 @@ func main() { type ( S1 struct { - A int32 + A int64 S2 } S2 struct { - B int32 + B int64 S3 } S3 struct { - C int32 + C int64 S4 } S4 struct { - D int32 + D int64 S5 } S5 struct { - E int32 + E int64 S6 } S6 struct { - F int32 + F int64 S7 } S7 struct { - G int32 + G int64 S8 } S8 struct { - H int32 + H int64 *S1 } ) @@ -96,24 +96,24 @@ func testDeep() { switch { case unsafe.Offsetof(s1.A) != 0: panic("unsafe.Offsetof(s1.A) != 0") - case unsafe.Offsetof(s1.B) != 4: - panic("unsafe.Offsetof(s1.B) != 4") - case unsafe.Offsetof(s1.C) != 8: - panic("unsafe.Offsetof(s1.C) != 8") - case unsafe.Offsetof(s1.D) != 12: - panic("unsafe.Offsetof(s1.D) != 12") - case unsafe.Offsetof(s1.E) != 16: - panic("unsafe.Offsetof(s1.E) != 16") - case unsafe.Offsetof(s1.F) != 20: - panic("unsafe.Offsetof(s1.F) != 20") - case unsafe.Offsetof(s1.G) != 24: - panic("unsafe.Offsetof(s1.G) != 24") - case unsafe.Offsetof(s1.H) != 28: - panic("unsafe.Offsetof(s1.H) != 28") - case unsafe.Offsetof(s1.S1) != 32: - panic("unsafe.Offsetof(s1.S1) != 32") - case unsafe.Offsetof(s1.S1.S2.S3.S4.S5.S6.S7.S8.S1.S2) != 4: - panic("unsafe.Offsetof(s1.S1.S2.S3.S4.S5.S6.S7.S8.S1.S2) != 4") + case unsafe.Offsetof(s1.B) != 8: + panic("unsafe.Offsetof(s1.B) != 8") + case unsafe.Offsetof(s1.C) != 16: + panic("unsafe.Offsetof(s1.C) != 16") + case unsafe.Offsetof(s1.D) != 24: + panic("unsafe.Offsetof(s1.D) != 24") + case unsafe.Offsetof(s1.E) != 32: + panic("unsafe.Offsetof(s1.E) != 32") + case unsafe.Offsetof(s1.F) != 40: + panic("unsafe.Offsetof(s1.F) != 40") + case unsafe.Offsetof(s1.G) != 48: + panic("unsafe.Offsetof(s1.G) != 48") + case unsafe.Offsetof(s1.H) != 56: + panic("unsafe.Offsetof(s1.H) != 56") + case unsafe.Offsetof(s1.S1) != 64: + panic("unsafe.Offsetof(s1.S1) != 64") + case unsafe.Offsetof(s1.S1.S2.S3.S4.S5.S6.S7.S8.S1.S2) != 8: + panic("unsafe.Offsetof(s1.S1.S2.S3.S4.S5.S6.S7.S8.S1.S2) != 8") } } |