summaryrefslogtreecommitdiff
path: root/libitm/testsuite/libitm.c/alloc-1.c
blob: 49faab5a0ba11d85ae348c802f8e542660530994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Test that rolling back allocations works.
#include <stdlib.h>

void __attribute((transaction_pure,noinline)) dont_optimize(void* p)
{
  *(volatile char *) p;
}

int main()
{
  __transaction_atomic {
    void *p = malloc (23);
    dont_optimize (p);
    __transaction_cancel;
  }
  return 0;
}