| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */ |
| 3 |
|
| 4 |
extern int something(void) __attribute__((transaction_safe)); |
| 5 |
extern int escape(int *) __attribute__((transaction_safe)); |
| 6 |
extern void *malloc (__SIZE_TYPE__) __attribute__((malloc,transaction_safe)); |
| 7 |
|
| 8 |
int f() |
| 9 |
{ |
| 10 |
int *p; |
| 11 |
|
| 12 |
__transaction_atomic { |
| 13 |
p = malloc (sizeof (*p) * 100); |
| 14 |
escape (p); |
| 15 |
|
| 16 |
/* This should be instrumented because P escapes. */ |
| 17 |
p[5] = 123; |
| 18 |
|
| 19 |
if (something()) |
| 20 |
__transaction_cancel; |
| 21 |
} |
| 22 |
return p[5]; |
| 23 |
} |
| 24 |
|
| 25 |
/* { dg-final { scan-tree-dump-times "ITM_WU" 1 "tmmark" } } */ |