Patchwork Fix PR52173

login
register
mail settings
Submitter Aldy Hernandez
Date Sept. 21, 2012, 6:16 p.m.
Message ID <505CAEF0.6090705@redhat.com>
Download mbox | patch
Permalink /patch/185871/
State New
Headers show

Comments

Aldy Hernandez - Sept. 21, 2012, 6:16 p.m.
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.

Thanks again.
Aldy
testsuite/
	PR middle-end/52173
	* gcc.dg/tm/pr52173-1.c: New.
	* gcc.dg/tm/pr52173-2.c: New.
Richard Guenther - Sept. 24, 2012, 8:49 a.m.
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.

Patch

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;
+}