| 1 |
/* { dg-xfail-run-if "unsupported" { *-*-* } } */ |
| 2 |
#include <stdlib.h> |
| 3 |
#include <libitm.h> |
| 4 |
|
| 5 |
/* Test that _ITM_dropReferences() forces a commit of given chunk. */ |
| 6 |
|
| 7 |
unsigned char pp[100]; |
| 8 |
|
| 9 |
int main() |
| 10 |
{ |
| 11 |
int i; |
| 12 |
|
| 13 |
for(i=0; i < 100; ++i) |
| 14 |
pp[i]=0x22; |
| 15 |
|
| 16 |
__transaction_atomic { |
| 17 |
for(i=0; i < 100; ++i) |
| 18 |
pp[i]=0x33; |
| 19 |
|
| 20 |
/* This should write-through pp[0..49]... */ |
| 21 |
_ITM_dropReferences (pp, 50); |
| 22 |
|
| 23 |
/* ...while this should revert everything but pp[0..49]. */ |
| 24 |
__transaction_cancel; |
| 25 |
} |
| 26 |
|
| 27 |
for(i=0; i < 50; ++i) |
| 28 |
if (pp[i] != 0x33) |
| 29 |
abort(); |
| 30 |
|
| 31 |
for(i=50; i < 100; ++i) |
| 32 |
if (pp[i] != 0x22) |
| 33 |
abort(); |
| 34 |
|
| 35 |
return 0; |
| 36 |
} |