Debian Codegraph @

gcc/testsuite/g++.dg/tm/nested-2.C

raw
1 // { dg-do compile }
2 // { dg-options "-fgnu-tm -O" }
3
4 typedef unsigned long int uint64_t;
5 extern int *hash_indx;
6
7 typedef struct
8 {
9 uint64_t exit_atomicsec_time;
10 } ent_ex_times;
11 class HashTree
12 {
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;
21 };
22
23
24 __attribute__((transaction_safe))
25 int HashTree::add_element()
26 {
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;
41 }