https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68591
Bug ID: 68591 Summary: trans-mem: missing transactional read in transaction when using -O1 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libitm Assignee: unassigned at gcc dot gnu.org Reporter: torvald at gcc dot gnu.org Target Milestone: --- Created attachment 36860 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36860&action=edit test case The attached test case miscompiles in that it does not transform the load from ptr in the conditional in the transaction into a transactional load. Instead, it seems to assume that ptr's value is fixed and not shared with other threads. This changes when the synchronization that could potentially make it share gets inlined into the function with the transaction. For simplicity, this is a single-threaded test, but I discovered that in a multi-threaded setting.