https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70889
Bug ID: 70889 Summary: memory reordering across loads tagged as memory_order_seq_cst Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: lucenadeveloper at gmail dot com Target Milestone: --- Based on my stackoverflow question here, http://stackoverflow.com/questions/36958372/gcc-reordering-up-across-load-with-memory-order-seq-cst-is-this-allowed, the RTL optimization stage reorders a nonatomic load up across a load tagged with memory_order_seq_cst. This violates some synchronizes-with relationships that should be established between reader and writer threads and breaks many synchronization primitives such as seqlocks. Further, this only occurs if the load in question is under 123 bytes. Anything >= 123 does not get reordered.