[HN Gopher] How to miscompile programs with "benign" data races ...
       ___________________________________________________________________
        
       How to miscompile programs with "benign" data races [pdf]
        
       Author : todsacerdoti
       Score  : 21 points
       Date   : 2025-01-10 23:01 UTC (3 days ago)
        
 (HTM) web link (www.usenix.org)
 (TXT) w3m dump (www.usenix.org)
        
       | swagmoney1606 wrote:
       | >Perhaps most surprisingly, this includes even the case of
       | potentially concurrent writes of the same value by different
       | threads.
       | 
       | Can someone explain to me how this is possible?
        
         | kccqzy wrote:
         | Go read section 2.4.
        
         | iracigt wrote:
         | Section 2.4 gives a concrete example, though there are some
         | asterisks. The example is one where a compiler rewrites
         | something like `while (...) x++;` to put `x` in a register:
         | `int reg = x; while (...) reg++; x = reg`. The author reports
         | this is an optimization GCC was observed doing, and means you
         | can have a read-writeback even when the while condition is
         | false to begin with. If this optimization appears interleaved
         | with identical writes then you have problems.
        
       | kccqzy wrote:
       | This needs (2011).
       | 
       | If I remember correctly this report is written in the context of
       | standardizing new features in C++11 related to synchronization,
       | threads, and the memory model.
        
       ___________________________________________________________________
       (page generated 2025-01-13 23:03 UTC)