[llvm-bugs] [Bug 49604] New: Implement the -Winvalid-memory-model

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 16 01:48:00 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49604

            Bug ID: 49604
           Summary: Implement the -Winvalid-memory-model
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: antoshkka at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

C/C++ memory model is hard and people do a lot of errors with it. A warning
from compiler could be very useful for cases when particular memory order
should not be used with particular atomic operation. Foe example
* store operations and memory_order_acquire or memory_order_acq_rel
* load operations and memory_order_release or memory_order_acq_rel
* CAS and memory_order_release or memory_order_acq_rel

Some compilers already implement such warning with -Winvalid-memory-model flag.

Godbolt Playground: https://godbolt.org/z/79bf19
GCC related tikets: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69104 and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99612

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210316/b8b894aa/attachment.html>


More information about the llvm-bugs mailing list