* gcc.target/i386/mpx/hard-reg-1-nov.c (mpx_test): Use "esp"
[official-gcc.git] / gcc / testsuite / gcc.dg / tm / memopt-11.c
blob44c538b54d5ab4cafce32dd6232df50262676718
1 /* { dg-do compile } */
2 /* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
4 extern int something(void) __attribute__((transaction_safe));
5 extern void *malloc (__SIZE_TYPE__) __attribute__((malloc,transaction_safe));
6 extern void foo (int);
8 int f()
10 int *p;
12 p = malloc (sizeof (*p) * 100);
13 foo(p[5]);
15 __transaction_atomic {
16 /* p[5] is thread private, however the SSA_NAME that holds the
17 address dominates the entire transaction (transaction
18 invariant) so we can use a save/restore pair. */
19 p[5] = 123;
21 if (something())
22 __transaction_cancel;
24 return p[5];
27 /* { dg-final { scan-tree-dump-times "ITM_LU" 0 "tmmark" } } */
28 /* { dg-final { scan-tree-dump-times "ITM_WU" 0 "tmmark" } } */
29 /* { dg-final { scan-tree-dump-times "int tm_save" 1 "tmmark" } } */