comparison gcc/testsuite/gcc.dg/tm/memopt-9.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-do compile } */
2 /* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
3
4 extern int something(void) __attribute__((transaction_safe));
5 extern void *malloc (__SIZE_TYPE__) __attribute__((malloc,transaction_safe));
6
7 struct large { int foo[500]; };
8
9 int f()
10 {
11 int *p;
12 struct large *lp;
13
14 __transaction_atomic {
15 p = malloc (sizeof (*p) * 100);
16 lp = malloc (sizeof (*lp) * 100);
17
18 /* No instrumentation necessary; P and LP are transaction local. */
19 p[5] = 123;
20 lp->foo[66] = 123;
21
22 if (something())
23 __transaction_cancel;
24 }
25 return p[5];
26 }
27
28 /* { dg-final { scan-tree-dump-times "ITM_WU" 0 "tmmark" } } */