https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82156

            Bug ID: 82156
           Summary: [7/8 regression] Atomic is_lock_free is not true for
                    16 byte type
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldionne.2 at gmail dot com
  Target Milestone: ---

The following code prints true on GCC 4.x, 5.x and 6.x, but not on GCC 7.x and
trunk:

    #include <atomic>
    #include <iostream>
    #include <type_traits>


    using T = std::aligned_storage_t<16>; // just a 16 bytes type
    std::atomic<T> atomic;

    int main() {
      std::cout << std::boolalpha << atomic.is_lock_free() << std::endl;
      std::cout << std::boolalpha << std::atomic<T>::is_always_lock_free <<
std::endl;
    }

I'd like to know whether this is a regression, or me misunderstanding the
meaning of `is_lock_free()`.

Live examples:
GCC 4.9 (true): https://wandbox.org/permlink/gg0HoiAofJXXxHzh
GCC 5 (true):   https://wandbox.org/permlink/vofEUemsQSpIROOR
GCC 6 (true):   https://wandbox.org/permlink/jH8spWex3KDKVT0a
GCC 7 (false):  https://wandbox.org/permlink/M1SG1B6StNtBjlxH
GCC 8 (false):  https://wandbox.org/permlink/4vmBcSph2Pvy4tye

Thanks!

Reply via email to