Skip to content

cmd/compile: linkname symbol redeclared, unknown line number #59313

@ii64

Description

@ii64

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

$ go version
go1.20

Does this issue reproduce with the latest release?

Yes, go1.20, go1.21, tip

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

go env Output
$ go env
[go playground]

What did you do?

package main

import (
	"fmt"
	"unsafe"
)

type M struct {
	p string
}

var k = []*M{
	{"a"}, {"b"}, {"c"},
}

//go:linkname x main.k
var x unsafe.Pointer

func main() {
	fmt.Println(k)
	fmt.Println(x)
}

Go playground link: https://go.dev/play/p/TzmdH78MJj-

What did you expect to see?

Address of k

What did you see instead?

./prog.go:14:5: <unknown line number>: symbol main.k redeclared

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions