Debian Codegraph @

gcc/testsuite/gcc.target/arm/pr67989.C

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