diff mbox

Fix predcom -fcompare-debug bug (PR debug/47684)

Message ID 20110210214443.GY30899@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Feb. 10, 2011, 9:44 p.m. UTC
Hi!

single_nonlooparound_use doesn't ignore debug uses, which results in
-fcompare-debug failures.  Fixed thusly, bootstrapped/regtested on
x86_64-linux and i686-linux, ok for trunk?

2011-02-10  Jakub Jelinek  <jakub@redhat.com>

	PR debug/47684
	* tree-predcom.c (single_nonlooparound_use): Ignore debug uses.

	* gcc.dg/pr47684.c: New test.


	Jakub

Comments

Richard Biener Feb. 11, 2011, 9:53 a.m. UTC | #1
On Thu, Feb 10, 2011 at 10:44 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> single_nonlooparound_use doesn't ignore debug uses, which results in
> -fcompare-debug failures.  Fixed thusly, bootstrapped/regtested on
> x86_64-linux and i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

> 2011-02-10  Jakub Jelinek  <jakub@redhat.com>
>
>        PR debug/47684
>        * tree-predcom.c (single_nonlooparound_use): Ignore debug uses.
>
>        * gcc.dg/pr47684.c: New test.
>
> --- gcc/tree-predcom.c.jj       2010-12-28 12:33:08.000000000 +0100
> +++ gcc/tree-predcom.c  2011-02-10 20:15:04.000000000 +0100
> @@ -1668,6 +1668,8 @@ single_nonlooparound_use (tree name)
>
>          return NULL;
>        }
> +      else if (is_gimple_debug (stmt))
> +       continue;
>       else if (ret != NULL)
>        return NULL;
>       else
> --- gcc/testsuite/gcc.dg/pr47684.c.jj   2011-02-10 20:17:36.000000000 +0100
> +++ gcc/testsuite/gcc.dg/pr47684.c      2011-02-10 20:17:16.000000000 +0100
> @@ -0,0 +1,20 @@
> +/* PR debug/47684 */
> +/* { dg-do compile } */
> +/* { dg-options "-O3 -fcompare-debug" } */
> +
> +int in[8][4];
> +int out[4];
> +
> +void
> +foo (void)
> +{
> +  int sum = 1;
> +  int i, j, k;
> +  for (k = 0; k < 4; k++)
> +    {
> +      for (j = 0; j < 4; j++)
> +       for (i = 0; i < 4; i++)
> +         sum *= in[i + k][j];
> +      out[k] = sum;
> +    }
> +}
>
>        Jakub
>
H.J. Lu May 1, 2012, 12:55 a.m. UTC | #2
On Thu, Feb 10, 2011 at 1:44 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> single_nonlooparound_use doesn't ignore debug uses, which results in
> -fcompare-debug failures.  Fixed thusly, bootstrapped/regtested on
> x86_64-linux and i686-linux, ok for trunk?
>
> 2011-02-10  Jakub Jelinek  <jakub@redhat.com>
>
>        PR debug/47684
>        * tree-predcom.c (single_nonlooparound_use): Ignore debug uses.
>

This may have caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53174
diff mbox

Patch

--- gcc/tree-predcom.c.jj	2010-12-28 12:33:08.000000000 +0100
+++ gcc/tree-predcom.c	2011-02-10 20:15:04.000000000 +0100
@@ -1668,6 +1668,8 @@  single_nonlooparound_use (tree name)
 
 	  return NULL;
 	}
+      else if (is_gimple_debug (stmt))
+	continue;
       else if (ret != NULL)
 	return NULL;
       else
--- gcc/testsuite/gcc.dg/pr47684.c.jj	2011-02-10 20:17:36.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr47684.c	2011-02-10 20:17:16.000000000 +0100
@@ -0,0 +1,20 @@ 
+/* PR debug/47684 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcompare-debug" } */
+
+int in[8][4];
+int out[4];
+
+void
+foo (void)
+{
+  int sum = 1;
+  int i, j, k;
+  for (k = 0; k < 4; k++)
+    {
+      for (j = 0; j < 4; j++)
+	for (i = 0; i < 4; i++)
+	  sum *= in[i + k][j];
+      out[k] = sum;
+    }
+}