Skip to content

cmd/compile: wrong pcln entry for instruction #49436

@aarzilli

Description

@aarzilli

go version devel go1.18-9e6ad46bcc Sun Nov 7 04:57:22 2021 +0000 linux/amd64

Given https://play.golang.org/p/wsCMMD9Jk9J compiled with -gcflags='-N -l' the method PushBack compiles to:

TEXT main.(*List[go.shape.int_0]).PushBack(SB) ./buggy.go
...
  buggy.go:22		0x454a90		488b00			MOVQ 0(AX), AX					
  buggy.go:31		0x454a93		8400			TESTB AL, 0(AX)					
  buggy.go:22		0x454a95		c6400801		MOVB $0x1, 0x8(AX)				
...

The instruction 0x454a93 gets assigned to a line outside of the PushBack function, in this case it's the call to PushBack but in more complex examples can be something completely unrelated. Can't make this happen without embedding and type parameters.

cc @dr2chase

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions