1 /* { dg-do compile } */
2 /* { dg-options "-fgnu-tm -O" } */
3 
4 /* Since the non TM version of new_node() gets optimized away, it
5    shouldn't appear in the clone table either.  */
6 /* { dg-final { scan-assembler-not "tm_clone_table" { target { ! *-*-darwin*  } } } } */
7 /* { dg-final { scan-assembler-not "__DATA,__tm_clone_table" { target *-*-darwin*  } } } */
8 
9 #define NULL 0
10 extern void *malloc (__SIZE_TYPE__);
11 
12 __attribute__((transaction_pure))
13 void exit(int status);
14 
15 typedef struct node {
16 } node_t;
17 
18 __attribute__((transaction_safe))
new_node(node_t * next)19 static node_t *new_node(node_t *next)
20 {
21   node_t *node;
22   node = (node_t *)malloc(sizeof(node_t));
23   if (node == NULL) {
24     exit(1);
25   }
26   return NULL;
27 }
28 
set_new()29 static node_t *set_new()
30 {
31   node_t *min, *max;
32   __transaction_atomic {
33     max = new_node(NULL);
34     min = new_node(max);
35   }
36   return min;
37 }
38 
main(int argc,char ** argv)39 int main(int argc, char **argv)
40 {
41   set_new();
42   return 0;
43 }
44