On 06/28/2016 09:56 AM, Martin Sebor wrote:
c++/71675 - __atomic_compare_exchange_n returns wrong type for
typed enum

__atomic_compare_exchange_n is documented to return bool but when
its operands are of one of the character types or derived from
it (such as a class enum in C++) it converts the bool result to
that type.  The attached patch corrects that to prevent this
conversion, analogously to what's already being done for
__sync_bool_compare_and_swap.

Martin

gcc-71675.diff


PR c++/71675 - __atomic_compare_exchange_n returns wrong type for typed enum

gcc/c-family/ChangeLog:
2016-06-28  Martin Sebor  <mse...@redhat.com>

        PR c++/71675
        * c-common.c (resolve_overloaded_builtin): Avoid converting
        __atomic_compare_exchange_n return type to that of what its
        first argument points to.

gcc/testsuite/ChangeLog:
2016-06-28  Martin Sebor  <mse...@redhat.com>

        PR c++/71675
        * g++.dg/ext/atomic-3.C: New test.
        * gcc.dg/atomic/pr71675.c: New test.
OK.  Thanks.
jeff

Reply via email to