[committed] libstdc++: Fix undefined shift when _Atomic_word is 64-bit

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu Dec 9 12:28:50 GMT 2021


Hi Jonathan,

>> > Ah yes, so we need to disable this optimization. Patch coming up ...
>>
>> Gah, I remembered to check that:
>>
>>       constexpr bool __double_word
>>         = sizeof(long long) == 2 * sizeof(_Atomic_word);
>>       // The ref-count members follow the vptr, so are aligned to
>>       // alignof(void*).
>>       constexpr bool __aligned = __alignof(long long) <= alignof(void*);
>>       if _GLIBCXX17_CONSTEXPR (__lock_free && __double_word && __aligned)
>>
>>
>> But for C++11 and C++14 that is a normal runtime condition not
>> if-constexpr, so the undefined shift still gets compiled, even though
>> it can never be reached at runtime.
>
> Fixed like so. Tested sparc-sun-solaris2.11, pushed to trunk.

great, thanks a lot.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


More information about the Gcc-patches mailing list