Skip to content

[intro.races] It is slightly unclear whether a data race can occur if no bits are changed #6551

@eisenwave

Description

@eisenwave

See OP's confusion in https://stackoverflow.com/q/77031819/5740428.

I believe that the current wording implies the following (I've elaborated on this in my answer https://stackoverflow.com/a/77032028/5740428):

int x = 0; // global variable

void concurrently() {
    x = 0; // may be a data race, even if the value of x prior to this assignment is zero
}

I think there should be a note or example somewhere (possibly [defns.access], [intro.races], [intro.multithread]) which explains that even if the value is unchanged (based on equality comparison), changing the value (in the abstract machine sense) still counts as modification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions