blob: c6d5d98ba7a86000b2f90c72e62719ed79576a20 [file] [log] [blame]
// { dg-do compile }
// { dg-options "-fgnu-tm -O" }
typedef unsigned long int uint64_t;
extern int *hash_indx;
typedef struct
{
uint64_t exit_atomicsec_time;
} ent_ex_times;
class HashTree
{
public:
__attribute__((transaction_safe))
void *operator new(__SIZE_TYPE__);
__attribute__((transaction_safe))
int add_element();
private:
HashTree **Hash_table;
int Count;
};
__attribute__((transaction_safe))
int HashTree::add_element()
{
ent_ex_times enter_exit_times_inside;
int val = hash_indx[5];
int tt;
if (Hash_table[val] == __null)
{
__transaction_atomic {
Hash_table[val] = new HashTree;
}
}
__transaction_atomic {
tt = Count++;
enter_exit_times_inside.exit_atomicsec_time = 5;
}
return tt;
}