-
Notifications
You must be signed in to change notification settings - Fork 1k
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
False positive on atomic write vs free #602
Comments
On second though, it can actually be a race according to C/C++ memory model. Test is added in revision 248522. |
Not a bug. |
came across this ^^ |
An update on this: this is now considered a defect in the standard. If the proposal is accepted, there is no race and TSAN shouldn't produce a race report. On first glance precise modelling is problematic. TSAN is all based on vector clocks and transitive HB. Everything is timestamped with per-thread clock and then checked against vector clocks. If we make the store HB the load, then it may cause massive false negatives, since now everything in the first HB the load (effectively promote all relaxed store/load to release/acquire). This is probably worse overall. Precise modelling will require some new per-pair-of-thread/per-location relation, which looks extremely expensive to maintain and does not worth it for this obscure corner case. A possible practical solution may be to wipe the store after the value was loaded (pretend the store did not happen anymore), or make it appear to happen at a much earlier point in time (at the time that HB the load). This should prevent this particular FP w/o introducing massive side effects. |
ThreadSanitizer currently reports a data race on the following program:
This is false positive.
However, nobody ever complained and fixing it will lead to false negatives for races that actually happen.
The text was updated successfully, but these errors were encountered: