Mercurial > hg > CbC > CbC_gcc
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/c-c++-common/tm/20111206.c Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,53 @@ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm -O2" } */ +/* This test case triggered block sharing between the two transactions. */ + +void func1 (void) __attribute__ ((transaction_callable, used)); +long func2 (void) __attribute__ ((transaction_callable, used)); +unsigned long rand (void); + +void client_run (void) +{ + long types[100]; + long i; + + for (i = 0; i < 100; i++) + { + long action = rand (); + + switch (action) + { + case 0: + { + __transaction_relaxed + { + long bill = func2 (); + if (bill >= 0) + { + func1 (); + } + } + break; + } + + case 1: + { + long n; + __transaction_relaxed + { + for (n = 0; n < 100; n++) + { + long t = types[n]; + switch (t) + { + case 0: + func1 (); + break; + } + } + } + break; + } + } + } +}