aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c
new file mode 100644
index 000000000..c25336d68
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
+
+/* Test that `nontrxn' doesn't end up inside the transaction. */
+
+typedef struct node {
+ int * val;
+ struct node *next;
+} node_t;
+
+node_t *next;
+int nontrxn1, nontrxn;
+
+static int set_remove(int * val)
+{
+ int result;
+ int * v;
+ __transaction_relaxed {
+ v = next->val;
+ result = (v == val);
+ if (result)
+ result = 2;
+ }
+ return result;
+}
+
+void test(void *data)
+{
+ extern void bark(void);
+ if (set_remove(0))
+ bark();
+ nontrxn = 99; /* Should be outside transaction. */
+}
+
+/* { dg-final { scan-tree-dump-times "_ITM_W.*nontrxn" 0 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */