summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tm/sync1.C
blob: a567b2cc3e26441f0e3fa20f084ea7e321f1caa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Testcase from TM TS.
// { dg-options -fgnu-tm }

extern "C" int printf (const char *, ...);

int f()
{
  static int i = 0;
  synchronized {
    printf("before %d\n", i);
    ++i;
    printf("after %d\n", i);
    return i;
  }
}