aboutsummaryrefslogtreecommitdiff
path: root/libitm/testsuite
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2015-11-22 20:56:20 +0000
committerTorvald Riegel <torvald@gcc.gnu.org>2015-11-22 20:56:20 +0000
commit4f8a3b87f948d472c2aeb1bc9177892c8fc6f113 (patch)
treedbf9990236cbe2cf507d8aa797ca2aaede516f99 /libitm/testsuite
parent9b22c1b69ad455177317dd945a5f0d0c5e43d58c (diff)
downloadgcc-4f8a3b87f948d472c2aeb1bc9177892c8fc6f113.zip
gcc-4f8a3b87f948d472c2aeb1bc9177892c8fc6f113.tar.gz
gcc-4f8a3b87f948d472c2aeb1bc9177892c8fc6f113.tar.bz2
libitm: Fix recent changes to allocations log.
libitm/ * libitm_i.h (gtm_alloc_action): Remove union. * testsuite/libitm.c/alloc-1.c: New. From-SVN: r230727
Diffstat (limited to 'libitm/testsuite')
-rw-r--r--libitm/testsuite/libitm.c/alloc-1.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libitm/testsuite/libitm.c/alloc-1.c b/libitm/testsuite/libitm.c/alloc-1.c
new file mode 100644
index 0000000..49faab5
--- /dev/null
+++ b/libitm/testsuite/libitm.c/alloc-1.c
@@ -0,0 +1,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;
+}