Skip to content

stamp_it triggers -Winvalid-memory-model when compiled with gcc12 #26

@captaincrutches

Description

@captaincrutches

When using stamp_it as the reclamation policy in a vyukov_hash_map or a harris_michael_list_based_set, this warning pops up when compiling with gcc-12:

In member function ‘bool std::atomic<_Tp>::compare_exchange_weak(_Tp&, _Tp, std::memory_order, std::memory_order) [with _Tp = xenium::marked_ptr<xenium::reclamation::stamp_it::thread_control_block, 18>]’,
    inlined from ‘static bool xenium::reclamation::stamp_it::thread_order_queue::mark_next(marked_ptr, size_t)’ at /home/captaincrutches/Projects/newt/thirdparty/xenium/xenium/reclamation/impl/stamp_it.hpp:513:44,
    inlined from ‘static bool xenium::reclamation::stamp_it::thread_order_queue::remove_from_prev_list(marked_ptr&, marked_ptr, marked_ptr&)’ at /home/captaincrutches/Projects/newt/thirdparty/xenium/xenium/reclamation/impl/stamp_it.hpp:281:23,
    inlined from ‘bool xenium::reclamation::stamp_it::thread_order_queue::remove(marked_ptr)’ at /home/captaincrutches/Projects/newt/thirdparty/xenium/xenium/reclamation/impl/stamp_it.hpp:148:47,
    inlined from ‘void xenium::reclamation::stamp_it::thread_data::leave_region()’ at /home/captaincrutches/Projects/newt/thirdparty/xenium/xenium/reclamation/impl/stamp_it.hpp:563:34:
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/g++-v12/atomic:325:41: warning: failure memory model ‘memory_order_acquire’ cannot be stronger than success memory model ‘memory_order_relaxed’ for ‘bool __atomic_compare_exchange_8(volatile void*, void*, long unsigned int, bool, int, int)’ [-Winvalid-memory-model]
  325 |         return __atomic_compare_exchange(std::__addressof(_M_i),
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
  326 |                                          std::__addressof(__e),
      |                                          ~~~~~~~~~~~~~~~~~~~~~~
  327 |                                          std::__addressof(__i),
      |                                          ~~~~~~~~~~~~~~~~~~~~~~
  328 |                                          true, int(__s), int(__f));
      |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/g++-v12/atomic:325:41: note: valid models are 'memory_order_relaxed'

This, along with some other warnings, has also been reported recently as a Debian bug.

I'm able to reproduce these -Werror failures building the gtest target on master using gcc-12.

Sounds like the current CI config might need to be updated from gcc-9 and clang-10...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions