aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tm/memopt-3.c
blob: 62a3e0e9f2a8a33e59bdf5b2cb6c5a71f5654fab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */

struct large { int x[100]; };
extern int test(void) __attribute__((transaction_safe));

int f()
{
  int i = readint();
  struct large lala = { 0 };
  __transaction_atomic {
    lala.x[i] = 666;
    if (test())
      __transaction_cancel;
  }
  return lala.x[0];
}

/* { dg-final { scan-tree-dump-times "logging: lala.x\\\[i_1\\\]" 1 "tmmark" { xfail *-*-* }  } } */
/* { dg-final { cleanup-tree-dump "tmmark" } } */