From 562b65fda730c16f4d2362f539347eb3f976a051 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Mon, 21 Jul 2014 21:15:39 -0700 Subject: [PATCH] vet: LEA* opcodes don't need to have matching length source and destination. LGTM=rsc R=golang-codereviews, khr, rsc CC=golang-codereviews https://golang.org/cl/117950044 --- cmd/vet/asmdecl.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/vet/asmdecl.go b/cmd/vet/asmdecl.go index 37259f47db..cd4befc1c9 100644 --- a/cmd/vet/asmdecl.go +++ b/cmd/vet/asmdecl.go @@ -444,6 +444,14 @@ func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr stri src = 2 case "arm.MOVB", "arm.MOVBU": src = 1 + // LEA* opcodes don't really read the second arg. + // They just take the address of it. + case "386.LEAL": + dst = 4 + case "amd64.LEAQ": + dst = 8 + case "amd64p32.LEAL": + dst = 4 default: if fn.arch.name == "386" || fn.arch.name == "amd64" { if strings.HasPrefix(op, "F") && (strings.HasSuffix(op, "D") || strings.HasSuffix(op, "DP")) {