quantum
quantum copied to clipboard
GCC 12 warning: Invalid memory model
Describe the bug
Compiler warning invalid-memory-model triggered on atomic_base.h.
To Reproduce
Compile with GCC 12.
Expected behavior
No warnings
Environment (please complete the following information):
- Operating System and Version: macOS 12.4, amd64, Bazel, Homebrew GCC 12.1.0_1, C++17 mode
Logs
In member function 'void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = int]',
inlined from 'void Bloomberg::quantum::Task::SuspensionGuard::set(int)' at external/com_bloomberg_quantum/quantum/quantum_task.h:131:34:
/usr/local/Cellar/gcc@12/12.1.0_1/bin/../lib/gcc/12/gcc/x86_64-apple-darwin21/12/../../../../../../include/c++/12/bits/atomic_base.h:464:25: warning: invalid memory model 'memory_order_acq_rel' for 'void __atomic_store_4(volatile void*, unsigned int, int)' [-Winvalid-memory-model]
464 | __atomic_store_n(&_M_i, __i, int(__m));
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/gcc@12/12.1.0_1/bin/../lib/gcc/12/gcc/x86_64-apple-darwin21/12/../../../../../../include/c++/12/bits/atomic_base.h:464:25: note: valid models are 'memory_order_relaxed', 'memory_order_seq_cst', 'memory_order_release'