aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c
blob: c25336d682a214b8a21116d27574a56072b78bce (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
/* { dg-do compile } */
/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */

/* Test that `nontrxn' doesn't end up inside the transaction.  */

typedef struct node {
  int * val;
  struct node *next;
} node_t;

node_t *next;
int nontrxn1, nontrxn;

static int set_remove(int * val)
{
  int result;
  int * v;
  __transaction_relaxed {
    v = next->val;
    result = (v == val);
    if (result)
      result = 2;
  }
  return result;
}

void test(void *data)
{
  extern void bark(void);
  if (set_remove(0))
    bark();
  nontrxn = 99;			/* Should be outside transaction.  */
}

/* { dg-final { scan-tree-dump-times "_ITM_W.*nontrxn" 0 "tmmark" } } */
/* { dg-final { cleanup-tree-dump "tmmark" } } */