Skip to content

Segfault from @atomic operation on typed field (miscompilation?) #57190

Closed
@adienes

Description

@adienes

this MWE segfaults

mutable struct Atomic
    @atomic x::Int
end

function add_one!()
    @atomic (Atomic(0).x) += 1
end

add_one!() # segfaults

but note it works fine if either the ::Int is removed, or if the Atomic(0) is constructed before passing in

mutable struct Atomic
    @atomic x::Int
end

function add_one!(a)
    @atomic (a.x) += 1
end

add_one!(Atomic(0)) # works

bisected to #51720

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions