https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110573
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Luke Geeson from comment #4) > I understand treating atomics as volatile has historical precedent but a > case can be made, at least on modern architectures and with improved > understanding of models, that atomics are not volatile and more > optimisations can be applied. > What do you think? Not really. The problem is you will need to add a new kind of memory access type on the RTL level, this is not something which can be done without getting things wrong and/or forgetting to update every place that might change volatileness (including the scheduler which itself getting right is hard). So treating them as volatile memory access on the RTL level is the easiest and best form here. Now on the gimple level, they are treated as a function call which itself is another can of worms.