libstdc++-v3
* include/bits/atomic_base.h (struct __atomic_base): Add
__attribute__((atomic) to member data element.
(struct __atomic_base<_PTp*>): Add __attribute__((atomic)) to member
data element.
* include/std/atomic (struct atomic): Add __attribute__((atomic)) to
member data element.
testsuite
* gcc.dg/atomic-exchange-{1-5}.c: Change atomic var to use
__attribute__((atomic)).
* gcc.dg/atomic-op-{1-5}.c: Add --std=c11 and change atomic var to
use _Atomic keyword.
===================================================================
*************** _GLIBCXX_BEGIN_NAMESPACE_VERSION
// atomic_char32_t char32_t
// atomic_wchar_t wchar_t
//
! // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or
! // 8 bytes, since that is what GCC built-in functions for atomic
// memory access expect.
template<typename _ITp>
struct __atomic_base
{
private:
! typedef _ITp __int_type;
! __int_type _M_i;
public:
__atomic_base() noexcept = default;
// atomic_char32_t char32_t
// atomic_wchar_t wchar_t
//
! // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, 8, or
! // 16 bytes, since that is what GCC built-in functions for atomic
// memory access expect.
template<typename _ITp>
struct __atomic_base
{
private:
! typedef _ITp __int_type;
! typedef _ITp __attribute__ ((atomic)) __atomic_int_type;
! __atomic_int_type _M_i;
public:
__atomic_base() noexcept = default;
*************** _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __atomic_base<_PTp*>
{
private:
! typedef _PTp* __pointer_type;
! __pointer_type _M_p;
// Factored out to facilitate explicit specialization.
constexpr ptrdiff_t
struct __atomic_base<_PTp*>
{
private:
! typedef _PTp* __pointer_type;
! typedef _PTp* __attribute ((atomic)) __atomic_pointer_type;
! __atomic_pointer_type _M_p;
// Factored out to facilitate explicit specialization.
constexpr ptrdiff_t
===================================================================
*************** _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct atomic
{
private:
! _Tp _M_i;
public:
atomic() noexcept = default;
struct atomic
{
private:
! _Tp __attribute ((atomic)) _M_i;
public:
atomic() noexcept = default;
===================================================================
***************
extern void abort(void);
! char v, count, ret;
main ()
{
extern void abort(void);
! char __attribute__ ((atomic)) v;
! char count, ret;
main ()
{
===================================================================
***************
extern void abort(void);
! short v, count, ret;
main ()
{
extern void abort(void);
! short __attribute__ ((atomic)) v;
! short count, ret;
main ()
{
===================================================================
***************
extern void abort(void);
! int v, count, ret;
main ()
{
extern void abort(void);
! int __attribute__ ((atomic)) v;
! int count, ret;
main ()
{
===================================================================
***************
extern void abort(void);
! long long v, count, ret;
main ()
{
extern void abort(void);
! long long __attribute__ ((atomic)) v;
! long long count, ret;
main ()
{
===================================================================
***************
extern void abort(void);
! __int128_t v, count, ret;
main ()
{
extern void abort(void);
! __int128_t __attribute__ ((atomic)) v;
! __int128_t count, ret;
main ()
{
===================================================================
***************
/* Test __atomic routines for existence and proper execution on 1 byte
values with each valid memory model. */
/* { dg-do run } */
/* { dg-require-effective-target sync_char_short } */
/* Test the execution of the __atomic_*OP builtin routines for a char. */
extern void abort(void);
! char v, count, res;
const char init = ~0;
/* The fetch_op routines return the original value before the operation. */
/* Test __atomic routines for existence and proper execution on 1 byte
values with each valid memory model. */
/* { dg-do run } */
+ /* { dg-options "--std=c11" } */
/* { dg-require-effective-target sync_char_short } */
/* Test the execution of the __atomic_*OP builtin routines for a char. */
extern void abort(void);
! _Atomic char v;
! char count, res;
const char init = ~0;
/* The fetch_op routines return the original value before the operation. */
*************** test_or ()
abort ();
}
+ int
main ()
{
test_fetch_add ();
===================================================================
***************
/* Test __atomic routines for existence and proper execution on 2 byte
values with each valid memory model. */
/* { dg-do run } */
+ /* { dg-options "--std=c11" } */
/* { dg-require-effective-target sync_char_short } */
***************
extern void abort(void);
! short v, count, res;
const short init = ~0;
/* The fetch_op routines return the original value before the operation. */
extern void abort(void);
! _Atomic short v;
! short count, res;
const short init = ~0;
/* The fetch_op routines return the original value before the operation. */
*************** test_or ()
abort ();
}
+ int
main ()
{
test_fetch_add ();
===================================================================
***************
/* Test __atomic routines for existence and proper execution on 4 byte
values with each valid memory model. */
/* { dg-do run } */
/* { dg-require-effective-target sync_int_long } */
/* Test the execution of the __atomic_*OP builtin routines for an int. */
extern void abort(void);
! int v, count, res;
const int init = ~0;
/* The fetch_op routines return the original value before the operation. */
/* Test __atomic routines for existence and proper execution on 4 byte
values with each valid memory model. */
/* { dg-do run } */
+ /* { dg-options "--std=c11" } */
/* { dg-require-effective-target sync_int_long } */
/* Test the execution of the __atomic_*OP builtin routines for an int. */
extern void abort(void);
! _Atomic int v;
! int count, res;
const int init = ~0;
/* The fetch_op routines return the original value before the operation. */
*************** test_or ()
abort ();
}
+ int
main ()
{
test_fetch_add ();
===================================================================
***************
values with each valid memory model. */
/* { dg-do run } */
/* { dg-require-effective-target sync_long_long_runtime } */
! /* { dg-options "" } */
! /* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
/* Test the execution of the __atomic_*OP builtin routines for long long. */
extern void abort(void);
! long long v, count, res;
const long long init = ~0;
/* The fetch_op routines return the original value before the operation. */
values with each valid memory model. */
/* { dg-do run } */
/* { dg-require-effective-target sync_long_long_runtime } */
! /* { dg-options "--std=c11" } */
! /* { dg-options "--std=c11 -march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
/* Test the execution of the __atomic_*OP builtin routines for long long. */
extern void abort(void);
! _Atomic long long v;
! long long count, res;
const long long init = ~0;
/* The fetch_op routines return the original value before the operation. */
*************** test_or ()
abort ();
}
+ int
main ()
{
test_fetch_add ();
===================================================================
***************
/* Test __atomic routines for existence and proper execution on 16 byte
values with each valid memory model. */
/* { dg-do run } */
/* { dg-require-effective-target sync_int_128_runtime } */
! /* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */
/* Test the execution of the __atomic_*OP builtin routines for an int_128. */
extern void abort(void);
! __int128_t v, count, res;
const __int128_t init = ~0;
/* The fetch_op routines return the original value before the operation. */
/* Test __atomic routines for existence and proper execution on 16 byte
values with each valid memory model. */
/* { dg-do run } */
+ /* { dg-options "--std=c11" } */
/* { dg-require-effective-target sync_int_128_runtime } */
! /* { dg-options "--std=c11 -mcx16" { target { i?86-*-* x86_64-*-* } } } */
/* Test the execution of the __atomic_*OP builtin routines for an int_128. */
extern void abort(void);
! _Atomic __int128_t v;
! __int128_t count, res;
const __int128_t init = ~0;
/* The fetch_op routines return the original value before the operation. */
*************** test_or ()
abort ();
}
+ int
main ()
{
test_fetch_add ();