view libitm/testsuite/libitm.c/alloc-1.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
line wrap: on
line source

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