libstdc++-v3: Handle iconv as optional for newlib builds [PR116362]
[official-gcc.git] / gcc / testsuite / g++.dg / tm / nested-2.C
blobc6d5d98ba7a86000b2f90c72e62719ed79576a20
1 // { dg-do compile }
2 // { dg-options "-fgnu-tm -O" }
4 typedef unsigned long int uint64_t;
5 extern int *hash_indx;
7 typedef struct
9   uint64_t exit_atomicsec_time;
10 } ent_ex_times;
11 class HashTree
13 public:
14    __attribute__((transaction_safe))
15    void *operator new(__SIZE_TYPE__);
16    __attribute__((transaction_safe))
17    int add_element();
18 private:
19    HashTree **Hash_table;
20    int Count;
24 __attribute__((transaction_safe))
25 int HashTree::add_element()
27  ent_ex_times enter_exit_times_inside;
28  int val = hash_indx[5];
29  int tt;
30  if (Hash_table[val] == __null)
31  {
32   __transaction_atomic {
33     Hash_table[val] = new HashTree;
34   }
35  }
36  __transaction_atomic {
37  tt = Count++;
38  enter_exit_times_inside.exit_atomicsec_time = 5;
39  }
40  return tt;