view gcc/testsuite/gcc.dg/tm/20100615.c @ 132:d34655255c78

update gcc-8.2
author mir3636
date Thu, 25 Oct 2018 10:21:07 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { 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;
}