Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Eisenwave opened this issue Sep 3, 2023 · 0 comments

Comments

@Eisenwave
Copy link
Contributor

Eisenwave commented Sep 3, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant