comparison gcc/testsuite/c-c++-common/tm/20111206.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-do compile } */
2 /* { dg-options "-fgnu-tm -O2" } */
3 /* This test case triggered block sharing between the two transactions. */
4
5 void func1 (void) __attribute__ ((transaction_callable, used));
6 long func2 (void) __attribute__ ((transaction_callable, used));
7 unsigned long rand (void);
8
9 void client_run (void)
10 {
11 long types[100];
12 long i;
13
14 for (i = 0; i < 100; i++)
15 {
16 long action = rand ();
17
18 switch (action)
19 {
20 case 0:
21 {
22 __transaction_relaxed
23 {
24 long bill = func2 ();
25 if (bill >= 0)
26 {
27 func1 ();
28 }
29 }
30 break;
31 }
32
33 case 1:
34 {
35 long n;
36 __transaction_relaxed
37 {
38 for (n = 0; n < 100; n++)
39 {
40 long t = types[n];
41 switch (t)
42 {
43 case 0:
44 func1 ();
45 break;
46 }
47 }
48 }
49 break;
50 }
51 }
52 }
53 }