aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tm/reg-promotion.c
blob: e48bfb2795d79c7bb7f9b40b0089aec875fff1fb (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
/* { dg-do compile } */
/* { dg-options "-fgnu-tm -O2 -fdump-tree-lim1" } */

/* Test that `count' is not written to unless p->data>0.  */

int count;

struct obj {
    int data;
    struct obj *next;
} *q;

void func()
{
  struct obj *p;
  __transaction_atomic {
    for (p = q; p; p = p->next)
      if (p->data > 0)
	count++;
  }
}

/* { dg-final { scan-tree-dump-times "Cannot hoist conditional load of count because it is in a transaction" 1 "lim1" } } */
/* { dg-final { cleanup-tree-dump "lim1" } } */