| 1 |
// { dg-do "compile" } |
| 2 |
// { dg-options "-fgnu-tm" } |
| 3 |
|
| 4 |
class Obj |
| 5 |
{ |
| 6 |
int dummy; |
| 7 |
}; |
| 8 |
|
| 9 |
__attribute__((transaction_safe)) |
| 10 |
Obj* allocate() |
| 11 |
{ |
| 12 |
return new Obj; |
| 13 |
} |
| 14 |
|
| 15 |
__attribute__((transaction_safe)) |
| 16 |
void deallocate(Obj * o) |
| 17 |
{ |
| 18 |
delete o; |
| 19 |
} |
| 20 |
|
| 21 |
__attribute__((transaction_safe)) |
| 22 |
Obj* allocatearray() |
| 23 |
{ |
| 24 |
return new Obj[2]; |
| 25 |
} |
| 26 |
|
| 27 |
__attribute__((transaction_safe)) |
| 28 |
void deallocatearray(Obj *o[]) |
| 29 |
{ |
| 30 |
delete [] o; |
| 31 |
} |
| 32 |
|
| 33 |
/* The delete/new operators are handled by the libitm runtime. */ |
| 34 |
/* { dg-final { scan-assembler "_ZGTtnw\[mj\]" } } */ |
| 35 |
/* { dg-final { scan-assembler "_ZGTtna\[mj\]" } } */ |
| 36 |
/* { dg-final { scan-assembler "_ZGTtdlPv" } } */ |
| 37 |
/* { dg-final { scan-assembler "_ZGTtdaPv" } } */ |