Sean Kelly Wrote: > > shared uint cnt; > > void atomicInc ( ) { uint o; while ( !cas( &cnt, o, o + 1 ) ) o = cnt; } > > > > is compiled with dmd -O to something like: > > > > shared uint cnt; > > void atomicInc ( ) { while ( !cas( &cnt, cnt, cnt + 1 ) ) { } } > What a mess. DMD isn't supposed to optimize across asm blocks.
There're no asm blocks in the code. It's a violated contract of shared data access.