Skip to content

cmd/vet: invalid move due to type clash, warning unclear #55936

Description

@piotr-sneller

What version of Go are you using (go version)?

go1.19.1 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Windows 10 64-bit

What did you do?

Create a Go file xxx.go with the following content:

package vm

type A [2]uint32

//go:noescape
//go:nosplit
func fun(a A)

And the assembly file xxx_amd64.s:

#include "textflag.h"
#include "funcdata.h"
#include "go_asm.h"

// func fun(a A)
TEXT ·fun(SB), NOSPLIT | NOFRAME, $0-0 
    MOVQ    a+0(FP), AX
    RET

Then run go vet

What did you expect to see?

Nothing; in particular no false positive warning.

What did you see instead?

.\xxx_amd64.s:7:1: [amd64] fun: invalid MOVQ of a+0(FP); vm.A is 8-byte value

The size of the array is exactly 8 bytes and yet go vet warns that 8 bytes != 8 bytes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AnalysisIssues related to static analysis (vet, x/tools/go/analysis)NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions