summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/tsan/func_entry_exit.c
blob: 9c1b697411cffebacb73b83c55b45268fae15a77 (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
/* { dg-do compile } */
/* { dg-options "-fdump-tree-gimple -fdump-tree-optimized" } */

int x;

__attribute__((noinline))
void fn1(void)
{
  x++;
}

__attribute__((noinline))
void fn2(void)
{
  fn1();
}

__attribute__((noinline))
int main(int argc, char *argv[])
{
  fn1();
  fn2();
  return 0;
}

// { dg-final { scan-tree-dump "TSAN_FUNC_EXIT" "gimple" } }
// { dg-final { scan-tree-dump-times "__tsan_func_entry" 3 "optimized" } }
// { dg-final { scan-tree-dump-times "__tsan_func_exit" 3 "optimized" } }
// { dg-final { scan-tree-dump "__tsan_write" "optimized" } }