Message ID | 505CAEF0.6090705@redhat.com |
---|---|
State | New |
Headers | show |
On Fri, 21 Sep 2012, Aldy Hernandez wrote: > On 09/21/12 08:52, Richard Guenther wrote: > > > > This bug happens because GIMPLE_TRANSACTION is a statement > > without real but with virtual operands. The short-cut in gimple_copy > > thus is overly optimistic. Fixed as follows. > > Thank you so much for fixing this. > > When you apply the patch, do you mind including the attached tests-- assuming > you are ok with them? Or I can commit them after you commit your patch if you > prefer. Sure, I'll commit it alongside the patch. Richard.
diff --git a/gcc/testsuite/gcc.dg/tm/pr52173-1.c b/gcc/testsuite/gcc.dg/tm/pr52173-1.c new file mode 100644 index 0000000..9ffa4d6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tm/pr52173-1.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm -O3" } */ + +int vec[500]; + +void func() +{ + __transaction_relaxed + { + vec[123] = 456; + } +} + +main() +{ + int i; + for(i = 0; i < 10; ++i) + func(); +} diff --git a/gcc/testsuite/gcc.dg/tm/pr52173-2.c b/gcc/testsuite/gcc.dg/tm/pr52173-2.c new file mode 100644 index 0000000..ca64893 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tm/pr52173-2.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm -O2" } */ + +int a; + +int main() +{ + int i; + for (i = 0; i < 1; ++i) + __transaction_atomic { ++a; } + return 0; +}