On 04/03/2015 07:13 AM, Jonathan Wakely wrote:
> +++ b/libstdc++-v3/include/std/atomic
> @@ -165,9 +165,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> struct atomic
> {
> private:
> - // Align 1/2/4/8/16-byte types the same as integer types of that size.
> + // Align 1/2/4/8/16-byte types the natural alignment of that size.
> // This matches the alignment effects of the C11 _Atomic qualifier.
> - static constexpr int _S_min_alignment
> + static constexpr int _S_int_alignment
> = sizeof(_Tp) == sizeof(char) ? alignof(char)
> : sizeof(_Tp) == sizeof(short) ? alignof(short)
> : sizeof(_Tp) == sizeof(int) ? alignof(int)
> @@ -178,6 +178,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> #endif
> : 0;
>
> + static constexpr int _S_min_alignment
> + = _S_int_alignment > sizeof(_Tp) ? _S_int_alignment : sizeof(_Tp);
> +
This doesn't work for non-power-of-two sized _Tp.
Again, we don't have *any* target for which alignof(integer) > sizeof(integer).
So if you care about forcing natural alignment, don't bother with the alignof
on the integrals, as you're doing with _S_int_alignment at the moment.
r~