public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix a typo in range_entry_cmp (PR tree-optimization/61686)
@ 2014-12-10  6:57 Marek Polacek
  2014-12-10  7:59 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Polacek @ 2014-12-10  6:57 UTC (permalink / raw)
  To: Jakub Jelinek, GCC Patches

I don't really know this code, but this typo looks obvious enough.
Using if (p->high != NULL_TREE) ... else if (p->high != NULL_TREE)
couldn't be possibly desired, so use Q in the else branch, as in
the code slightly above.

Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk?

2014-12-10  Marek Polacek  <polacek@redhat.com>

	PR tree-optimization/61686
	* tree-ssa-reassoc.c (range_entry_cmp): Use q->high instead of
	p->high.

diff --git gcc/tree-ssa-reassoc.c gcc/tree-ssa-reassoc.c
index 68a67b6..00bca8b 100644
--- gcc/tree-ssa-reassoc.c
+++ gcc/tree-ssa-reassoc.c
@@ -2069,7 +2069,7 @@ range_entry_cmp (const void *a, const void *b)
 	      else
 		return -1;
 	    }
-	  else if (p->high != NULL_TREE)
+	  else if (q->high != NULL_TREE)
 	    return 1;
 	  /* If both ranges are the same, sort below by ascending idx.  */
 	}

	Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix a typo in range_entry_cmp (PR tree-optimization/61686)
  2014-12-10  6:57 [PATCH] Fix a typo in range_entry_cmp (PR tree-optimization/61686) Marek Polacek
@ 2014-12-10  7:59 ` Jakub Jelinek
  2014-12-10  8:11   ` Marek Polacek
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2014-12-10  7:59 UTC (permalink / raw)
  To: Marek Polacek; +Cc: GCC Patches

On Wed, Dec 10, 2014 at 07:57:46AM +0100, Marek Polacek wrote:
> I don't really know this code, but this typo looks obvious enough.
> Using if (p->high != NULL_TREE) ... else if (p->high != NULL_TREE)
> couldn't be possibly desired, so use Q in the else branch, as in
> the code slightly above.
> 
> Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk?
> 
> 2014-12-10  Marek Polacek  <polacek@redhat.com>
> 
> 	PR tree-optimization/61686
> 	* tree-ssa-reassoc.c (range_entry_cmp): Use q->high instead of
> 	p->high.

Ok for trunk/4.9/4.8.  Shouldn't we have a FE warning for this kind of thing?
I mean
  if (conditionX)
    {
    }
  else if (conditionY)
    ...
when the two conditions don't have side-effects and are operand_equal_p?

> diff --git gcc/tree-ssa-reassoc.c gcc/tree-ssa-reassoc.c
> index 68a67b6..00bca8b 100644
> --- gcc/tree-ssa-reassoc.c
> +++ gcc/tree-ssa-reassoc.c
> @@ -2069,7 +2069,7 @@ range_entry_cmp (const void *a, const void *b)
>  	      else
>  		return -1;
>  	    }
> -	  else if (p->high != NULL_TREE)
> +	  else if (q->high != NULL_TREE)
>  	    return 1;
>  	  /* If both ranges are the same, sort below by ascending idx.  */
>  	}

	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix a typo in range_entry_cmp (PR tree-optimization/61686)
  2014-12-10  7:59 ` Jakub Jelinek
@ 2014-12-10  8:11   ` Marek Polacek
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Polacek @ 2014-12-10  8:11 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches

On Wed, Dec 10, 2014 at 08:59:09AM +0100, Jakub Jelinek wrote:
> On Wed, Dec 10, 2014 at 07:57:46AM +0100, Marek Polacek wrote:
> > I don't really know this code, but this typo looks obvious enough.
> > Using if (p->high != NULL_TREE) ... else if (p->high != NULL_TREE)
> > couldn't be possibly desired, so use Q in the else branch, as in
> > the code slightly above.
> > 
> > Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk?
> > 
> > 2014-12-10  Marek Polacek  <polacek@redhat.com>
> > 
> > 	PR tree-optimization/61686
> > 	* tree-ssa-reassoc.c (range_entry_cmp): Use q->high instead of
> > 	p->high.
> 
> Ok for trunk/4.9/4.8.  Shouldn't we have a FE warning for this kind of thing?
> I mean
>   if (conditionX)
>     {
>     }
>   else if (conditionY)
>     ...
> when the two conditions don't have side-effects and are operand_equal_p?

Yes, we should, I'll file a PR.  Not sure whether such a warning is
stage 3 material.

Thanks,

	Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-10  8:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10  6:57 [PATCH] Fix a typo in range_entry_cmp (PR tree-optimization/61686) Marek Polacek
2014-12-10  7:59 ` Jakub Jelinek
2014-12-10  8:11   ` Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).