[ABI PATCH] static anonymous unions of function scope
[official-gcc.git] / libitm / testsuite / libitm.c / dropref-2.c
blob5bb2726dbd963fa58a8926cc41957e6fb31de411
1 /* { dg-xfail-run-if "unsupported" { *-*-* } } */
2 #include <stdlib.h>
3 #include <libitm.h>
5 /* Test that _ITM_dropReferences() forces a commit of given chunk. */
7 unsigned char pp[100];
9 int main()
11 int i;
13 for(i=0; i < 100; ++i)
14 pp[i]=0x22;
16 __transaction_atomic {
17 for(i=0; i < 100; ++i)
18 pp[i]=0x33;
20 /* This should write-through pp[0..49]... */
21 _ITM_dropReferences (pp, 50);
23 /* ...while this should revert everything but pp[0..49]. */
24 __transaction_cancel;
27 for(i=0; i < 50; ++i)
28 if (pp[i] != 0x33)
29 abort();
31 for(i=50; i < 100; ++i)
32 if (pp[i] != 0x22)
33 abort();
35 return 0;