From: Alan Stern > Sent: 29 March 2019 19:45 ... > There is a big difference between WRITE_ONCE() and plain assignment. > Given "WRITE_ONCE(X, 2)", the compiler will emit a simple store > instruction. But given "X = 2", the compiler is allowed to emit > instructions equivalent to: > > if (X != 2) > X = 2; Worse for you, it can also emit: X = 0; X = 2; Many years ago I fell foul of a compiler (not C) that implemented a write to a 2 bit wide bitfield as: X &= ~3 X |= value even when 'value' was a compile time constant of 3. Took a while to find out why the linked list got f*cked. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)