diff options
author | torvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-22 20:56:20 +0000 |
---|---|---|
committer | torvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-22 20:56:20 +0000 |
commit | f7e68284b737222c5f34cd4aa40f31c4bd0f1263 (patch) | |
tree | dbf9990236cbe2cf507d8aa797ca2aaede516f99 /libitm | |
parent | 415293ccb62afe6441a9568b020636cf1a803464 (diff) | |
download | gcc-f7e68284b737222c5f34cd4aa40f31c4bd0f1263.tar.gz |
libitm: Fix recent changes to allocations log.
libitm/
* libitm_i.h (gtm_alloc_action): Remove union.
* testsuite/libitm.c/alloc-1.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230727 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libitm')
-rw-r--r-- | libitm/ChangeLog | 5 | ||||
-rw-r--r-- | libitm/libitm_i.h | 10 | ||||
-rw-r--r-- | libitm/testsuite/libitm.c/alloc-1.c | 17 |
3 files changed, 26 insertions, 6 deletions
diff --git a/libitm/ChangeLog b/libitm/ChangeLog index 4be05613c6c..a986e6766f1 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,8 @@ +2015-11-22 Torvald Riegel <triegel@redhat.com> + + * libitm_i.h (gtm_alloc_action): Remove union. + * testsuite/libitm.c/alloc-1.c: New. + 2015-11-19 Torvald Riegel <triegel@redhat.com> * testsuite/libitm.c++/eh-5.C: New. diff --git a/libitm/libitm_i.h b/libitm/libitm_i.h index f01a1ab54e4..4b72348da59 100644 --- a/libitm/libitm_i.h +++ b/libitm/libitm_i.h @@ -106,12 +106,10 @@ namespace GTM HIDDEN { // the template used inside gtm_thread can instantiate. struct gtm_alloc_action { - // Iff free_fn_sz is nonzero, it must be used instead of free_fn. - union - { - void (*free_fn)(void *); - void (*free_fn_sz)(void *, size_t); - }; + // Iff free_fn_sz is nonzero, it must be used instead of free_fn, and vice + // versa. + void (*free_fn)(void *); + void (*free_fn_sz)(void *, size_t); size_t sz; // If true, this is an allocation; we discard the log entry on outermost // commit, and deallocate on abort. If false, this is a deallocation and diff --git a/libitm/testsuite/libitm.c/alloc-1.c b/libitm/testsuite/libitm.c/alloc-1.c new file mode 100644 index 00000000000..49faab5a0ba --- /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; +} |