This is an archive of the discontinued LLVM Phabricator instance.

Diagnose invalid failure memory orderings.
Needs RevisionPublic

Authored by EricWF on Jul 22 2016, 5:49 PM.

Details

Summary

Clang currently issues diagnostics if the success memory order argument is invalid, but it doesn't check the failure ordering argument for cmpxchg atomic operations.
This patch adds diagnostics if the failure ordering is either memory_order_release or memory_order_acq_rel.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 65200.Jul 22 2016, 5:49 PM
EricWF retitled this revision from to Diagnose invalid failure memory orderings..
EricWF updated this object.
EricWF added reviewers: majnemer, jfb, rsmith.
EricWF added a subscriber: cfe-commits.

ping. Clang correctly lowers the invalid memory orders, so do we want these diagnostics?

jfb edited edge metadata.Aug 10 2016, 5:31 PM

Warnings look correct. Could they be made more useful by suggesting that acq_rel be acquire instead, and release be relaxed instead?

jfb requested changes to this revision.May 7 2018, 10:13 PM

Given http://wg21.link/p0418 I think this requires an update. I don't think the old behavior is worth supporting in older -std= versions, unless we're worried that it would make code less portable.

This revision now requires changes to proceed.May 7 2018, 10:13 PM