aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tm/pr47530-2.C
blob: bcfdbe94830e94e4d87d10ee14efe6ab931549ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// { dg-do compile }
// { dg-options "-fgnu-tm -O2 -fno-inline -fdump-tree-tmedge" }

class RBTree
{
    struct RBNode
    {
      RBNode* next;
    };

  public:
    RBNode* sentinel;
    __attribute__((transaction_safe)) bool lookup();
};

bool RBTree::lookup()
{
  RBNode* x = sentinel;
  while (x)
    x = x->next;
  return false;
}


RBTree* SET;

void bench_test()
{
  __transaction_atomic { 
      SET->lookup();
    }
}

// There should be two calls to commitTransaction.
// The one in the uninstrumented code path is a tail call.
// The one in the instrumented code path is not.
// { dg-final { scan-tree-dump-times "ITM_commitTransaction.*tail call" 1 "tmedge" } }

// { dg-final { cleanup-tree-dump "tmedge" } }