Skip to content

cmd/gc: address &x.f is not resolved at link time #9355

Closed
@randall77

Description

@randall77

If you do
var y=&x

Then global y points to global x, and that reference is computed at link time.

If you do (where f is a field of x)
var y = &x.f

This reference is not computed at link time. Instead, it is set up dynamically by init(). This means that other code during init can see y as nil.

See #9354 for why this matters.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions