]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: match cmd/compile's alignment for complex64
authorMatthew Dempsky <mdempsky@google.com>
Tue, 25 Oct 2016 15:39:19 +0000 (08:39 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 25 Oct 2016 16:33:01 +0000 (16:33 +0000)
Fixes #17584.

Change-Id: I3af31cc1f2e9c906f3b73e77f3b092624ba78fbe
Reviewed-on: https://go-review.googlesource.com/31939
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/vet/testdata/asm.go
src/cmd/vet/testdata/asm1.s
src/go/types/sizes.go

index 3f9275c008bc87bc0e5e9302899837de400dd290..e6d6d031061227fc201dc9cc4d1e4c379ff801e6 100644 (file)
@@ -42,3 +42,4 @@ func noptr(x int)
 func wrapper(x int)
 
 func f15271() (x uint32)
+func f17584(x float32, y complex64)
index bc8cbc2e798bef5fd393d0c2c23811842498682d..cac6ed22cd0031f16c37689e4e750cb0ee15682f 100644 (file)
@@ -306,3 +306,10 @@ TEXT ·f15271(SB), NOSPLIT, $0-4
     // Return them.
     PEXTRD $0, X0, x+0(FP)
     RET
+
+// issue 17584
+TEXT ·f17584(SB), NOSPLIT, $12
+       MOVSS   x+0(FP), X0
+       MOVSS   y_real+4(FP), X0
+       MOVSS   y_imag+8(FP), X0
+       RET
index 6efd0b1394377e3d22c19dc57a0d1e4deb6e6134..3bbe5aee40ae6c3bc0c231c5d71f3e80e39f0d3e 100644 (file)
@@ -79,6 +79,10 @@ func (s *StdSizes) Alignof(T Type) int64 {
        if a < 1 {
                return 1
        }
+       // complex{64,128} are aligned like [2]float{32,64}.
+       if isComplex(T) {
+               a /= 2
+       }
        if a > s.MaxAlign {
                return s.MaxAlign
        }