1 /* { dg-do compile } */
2 /* { dg-options "-std=c++11 -O2" } */
3 /* { dg-require-effective-target arm_arch_v4t_ok } */
4 /* { dg-add-options arm_arch_v4t } */
5 /* { dg-additional-options "-marm" } */
6 
7 /* Duplicate version of the test in g++.dg to be able to run this test only if
8    ARMv4t in ARM execution state can be targetted.  Newer architecture don't
9    expose the bug this testcase was written for.  */
10 
11 
12 __extension__ typedef unsigned long long int uint64_t;
13 namespace std __attribute__ ((__visibility__ ("default")))
14 {
15   typedef enum memory_order
16   {
17     memory_order_seq_cst
18   } memory_order;
19 }
20 
21 namespace std __attribute__ ((__visibility__ ("default")))
22 {
23   template < typename _Tp > struct atomic
24   {
25     static constexpr int _S_min_alignment
26       = (sizeof (_Tp) & (sizeof (_Tp) - 1)) || sizeof (_Tp) > 16
27       ? 0 : sizeof (_Tp);
28     static constexpr int _S_alignment
29       = _S_min_alignment > alignof (_Tp) ? _S_min_alignment : alignof (_Tp);
30       alignas (_S_alignment) _Tp _M_i;
_Tpatomic31     operator  _Tp () const noexcept
32     {
33       return load ();
34     }
35     _Tp load (memory_order __m = memory_order_seq_cst) const noexcept
36     {
37       _Tp tmp;
38         __atomic_load (&_M_i, &tmp, __m);
39     }
40   };
41 }
42 
43 namespace lldb_private
44 {
45   namespace imp
46   {
47   }
48   class Address;
49 }
50 namespace lldb
51 {
52   typedef uint64_t addr_t;
53   class SBSection
54   {
55   };
56   class SBAddress
57   {
58     void SetAddress (lldb::SBSection section, lldb::addr_t offset);
59       lldb_private::Address & ref ();
60   };
61 }
62 namespace lldb_private
63 {
64   class Address
65   {
66   public:
SetOffset(lldb::addr_t offset)67     const Address & SetOffset (lldb::addr_t offset)
68     {
69       bool changed = m_offset != offset;
70     }
71     std::atomic < lldb::addr_t > m_offset;
72   };
73 }
74 
75 using namespace lldb;
76 using namespace lldb_private;
77 void
SetAddress(lldb::SBSection section,lldb::addr_t offset)78 SBAddress::SetAddress (lldb::SBSection section, lldb::addr_t offset)
79 {
80   Address & addr = ref ();
81   addr.SetOffset (offset);
82 }
83