]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/vet: teach asmdecl check about NOFRAME
authorAustin Clements <austin@google.com>
Tue, 6 Feb 2018 22:39:50 +0000 (17:39 -0500)
committerAustin Clements <austin@google.com>
Mon, 12 Feb 2018 21:41:29 +0000 (21:41 +0000)
Change-Id: I3f71228e391f122f9cc5656ca6835fdf51a424b7
Reviewed-on: https://go-review.googlesource.com/92435
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/vet/asmdecl.go
src/cmd/vet/testdata/asm/asm.go
src/cmd/vet/testdata/asm/asm3.s

index b01d23d342ba5372f2c06ffbf829ab2e5d8bc1dc..d3335c69f561ec863c646a8d3fbed25238185a27 100644 (file)
@@ -240,17 +240,17 @@ Files:
                                                continue
                                        }
                                }
+                               flag := m[3]
                                fn = knownFunc[fnName][arch]
                                if fn != nil {
                                        size, _ := strconv.Atoi(m[5])
-                                       flag := m[3]
                                        if size != fn.size && (flag != "7" && !strings.Contains(flag, "NOSPLIT") || size != 0) {
                                                badf("wrong argument size %d; expected $...-%d", size, fn.size)
                                        }
                                }
                                localSize, _ = strconv.Atoi(m[4])
                                localSize += archDef.intSize
-                               if archDef.lr {
+                               if archDef.lr && !strings.Contains(flag, "NOFRAME") {
                                        // Account for caller's saved LR
                                        localSize += archDef.intSize
                                }
index e6d6d031061227fc201dc9cc4d1e4c379ff801e6..2237ddc3b05c9324cf9c1dabbf0fba4093810bbc 100644 (file)
@@ -43,3 +43,6 @@ func wrapper(x int)
 
 func f15271() (x uint32)
 func f17584(x float32, y complex64)
+
+func noframe1(x int32)
+func noframe2(x int32)
index 3d69356a0f93f811fdf1e727964e7da5acc3a5e3..83e53862d7d1b6e649cb8fe048c78b27358d1997 100644 (file)
@@ -176,3 +176,17 @@ TEXT ·leaf(SB),0,$-4-12
        MOVW    y+4(FP), AX
        MOVW    AX, ret+8(FP)
        RET
+
+TEXT ·noframe1(SB),0,$0-4
+       MOVW    0(R13), AX // Okay; our saved LR
+       MOVW    4(R13), AX // Okay; caller's saved LR
+       MOVW    x+8(R13), AX // Okay; x argument
+       MOVW    12(R13), AX // ERROR "use of 12\(R13\) points beyond argument frame"
+       RET
+
+TEXT ·noframe2(SB),NOFRAME,$0-4
+       MOVW    0(R13), AX // Okay; caller's saved LR
+       MOVW    x+4(R13), AX // Okay; x argument
+       MOVW    8(R13), AX // ERROR "use of 8\(R13\) points beyond argument frame"
+       MOVW    12(R13), AX // ERROR "use of 12\(R13\) points beyond argument frame"
+       RET