+2015-03-26 Richard Henderson <rth@redhat.com>
+
+ PR libstdc++/65033
+ * include/bits/atomic_base.h (__atomic_base<T>::is_lock_free): Build
+ a fake pointer indicating type alignment.
+ (__atomic_base<T *>::is_lock_free): Likewise.
+ * include/std/atomic (atomic<T>::is_lock_free): Likewise.
+
2015-03-25 Alan Lawrence <alan.lawrence@arm.com>
PR libstdc++/33394
bool
is_lock_free() const noexcept
- { return __atomic_is_lock_free(sizeof(_M_i), nullptr); }
+ {
+ // Produce a fake, minimally aligned pointer.
+ void *__a = reinterpret_cast<void *>(-__alignof(_M_i));
+ return __atomic_is_lock_free(sizeof(_M_i), __a);
+ }
bool
is_lock_free() const volatile noexcept
- { return __atomic_is_lock_free(sizeof(_M_i), nullptr); }
+ {
+ // Produce a fake, minimally aligned pointer.
+ void *__a = reinterpret_cast<void *>(-__alignof(_M_i));
+ return __atomic_is_lock_free(sizeof(_M_i), __a);
+ }
_GLIBCXX_ALWAYS_INLINE void
store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept
bool
is_lock_free() const noexcept
- { return __atomic_is_lock_free(sizeof(__pointer_type), nullptr); }
+ {
+ // Produce a fake, minimally aligned pointer.
+ void *__a = reinterpret_cast<void *>(-__alignof(_M_p));
+ return __atomic_is_lock_free(sizeof(_M_p), __a);
+ }
bool
is_lock_free() const volatile noexcept
- { return __atomic_is_lock_free(sizeof(__pointer_type), nullptr); }
+ {
+ // Produce a fake, minimally aligned pointer.
+ void *__a = reinterpret_cast<void *>(-__alignof(_M_p));
+ return __atomic_is_lock_free(sizeof(_M_p), __a);
+ }
_GLIBCXX_ALWAYS_INLINE void
store(__pointer_type __p,
bool
is_lock_free() const noexcept
- { return __atomic_is_lock_free(sizeof(_M_i), nullptr); }
+ {
+ // Produce a fake, minimally aligned pointer.
+ void *__a = reinterpret_cast<void *>(-__alignof(_M_i));
+ return __atomic_is_lock_free(sizeof(_M_i), __a);
+ }
bool
is_lock_free() const volatile noexcept
- { return __atomic_is_lock_free(sizeof(_M_i), nullptr); }
+ {
+ // Produce a fake, minimally aligned pointer.
+ void *__a = reinterpret_cast<void *>(-__alignof(_M_i));
+ return __atomic_is_lock_free(sizeof(_M_i), __a);
+ }
void
store(_Tp __i, memory_order __m = memory_order_seq_cst) noexcept