| 1 |
// { dg-do compile } |
| 2 |
// { dg-options "-fgnu-tm -O0" } |
| 3 |
|
| 4 |
// Same as nested-2.C but with no optimization. |
| 5 |
|
| 6 |
typedef unsigned long int uint64_t; |
| 7 |
extern int *hash_indx; |
| 8 |
|
| 9 |
typedef struct |
| 10 |
{ |
| 11 |
uint64_t exit_atomicsec_time; |
| 12 |
} ent_ex_times; |
| 13 |
class HashTree |
| 14 |
{ |
| 15 |
public: |
| 16 |
__attribute__((transaction_safe)) |
| 17 |
void *operator new(__SIZE_TYPE__); |
| 18 |
__attribute__((transaction_safe)) |
| 19 |
int add_element(); |
| 20 |
private: |
| 21 |
HashTree **Hash_table; |
| 22 |
int Count; |
| 23 |
}; |
| 24 |
|
| 25 |
|
| 26 |
__attribute__((transaction_safe)) |
| 27 |
int HashTree::add_element() |
| 28 |
{ |
| 29 |
ent_ex_times enter_exit_times_inside; |
| 30 |
int val = hash_indx[5]; |
| 31 |
int tt; |
| 32 |
if (Hash_table[val] == __null) |
| 33 |
{ |
| 34 |
__transaction_atomic { |
| 35 |
Hash_table[val] = new HashTree; |
| 36 |
} |
| 37 |
} |
| 38 |
__transaction_atomic { |
| 39 |
tt = Count++; |
| 40 |
enter_exit_times_inside.exit_atomicsec_time = 5; |
| 41 |
} |
| 42 |
return tt; |
| 43 |
} |