Skip to content

runtime/race: detect races between atomic and non-atomic reads  #7621

@dvyukov

Description

@dvyukov
There is the comment in src/pkg/sync/atomic/race.go:

// We use runtime.RaceRead() inside of atomic operations to catch races
// between atomic and non-atomic operations.  It will also catch races
// between Mutex.Lock() and mutex overwrite (mu = Mutex{}).  Since we use
// only RaceRead() we won't catch races with non-atomic loads.
// Otherwise (if we use RaceWrite()) we will report races
// between atomic operations (false positives).

So the race detector doesn't catch races between atomic operations and non-atomic loads.
It should.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions