On Tue, Sep 11, 2012 at 1:15 AM, Aldy Hernandez <al...@redhat.com> wrote: > In this failing testcase the LIM pass writes to g_13 regardless of the > initial value of g_13, which is the test protecting the write. This causes > an incorrect store data race wrt both the C++ memory model and transactional > memory (the latter if the store occurs inside of a transaction). > > The problem here is that the ``lsm_flag'' temporary should only be set to > true on the code paths where we actually set the original global. As it > stands, we are setting lsm_flag to true for reads or writes. > > Fixed by only setting lsm_flag=1 when the original code path has a write. > > Tested on x86-64 Linux. > > OK for trunk?
+ /* Only set the flag for writes. */ + if (is_gimple_assign (loc->stmt) + && gimple_assign_lhs (loc->stmt) == *loc->ref) ok with && gimple_assign_lhs_ptr (loc->stmt) == loc->ref instead. Let's hope we conservatively catch all writes to ref this way (which is what we need, right)? Thanks, Richard.