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