public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix find_base_term
@ 2009-04-22 11:22 Jakub Jelinek
  2009-04-22 11:27 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2009-04-22 11:22 UTC (permalink / raw)
  To: gcc-patches

Hi!

The http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01402.html
patch IMHO broke CONST (PLUS) and CONST (MINUS) handling
in find_base_term.  Before that change, the CONST case just
fell through to the PLUS/MINUS (and at that time LO_SUM as well)
case, but now it falls through to the LO_SUM case which just considers
the second operand, not the first (but CONST had a PLUS or MINUS
in it, not LO_SUM).  I don't have a testcase that broke because of
this, the bug was found by accident when looking at the function.

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

2009-04-22  Jakub Jelinek  <jakub@redhat.com>

	* alias.c (find_base_term): Move around LO_SUM case, so that
	CONST falls through into PLUS/MINUS handling.

--- gcc/alias.c.jj	2009-04-21 11:16:28.000000000 +0200
+++ gcc/alias.c	2009-04-21 12:44:18.000000000 +0200
@@ -1438,15 +1438,16 @@ find_base_term (rtx x)
 	  return x;
       return 0;
 
+    case LO_SUM:
+      /* The standard form is (lo_sum reg sym) so look only at the
+         second operand.  */
+      return find_base_term (XEXP (x, 1));
+
     case CONST:
       x = XEXP (x, 0);
       if (GET_CODE (x) != PLUS && GET_CODE (x) != MINUS)
 	return 0;
       /* Fall through.  */
-    case LO_SUM:
-      /* The standard form is (lo_sum reg sym) so look only at the
-         second operand.  */
-      return find_base_term (XEXP (x, 1));
     case PLUS:
     case MINUS:
       {

	Jakub

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

* Re: [PATCH] Fix find_base_term
  2009-04-22 11:22 [PATCH] Fix find_base_term Jakub Jelinek
@ 2009-04-22 11:27 ` Richard Guenther
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2009-04-22 11:27 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Wed, Apr 22, 2009 at 1:22 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> The http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01402.html
> patch IMHO broke CONST (PLUS) and CONST (MINUS) handling
> in find_base_term.  Before that change, the CONST case just
> fell through to the PLUS/MINUS (and at that time LO_SUM as well)
> case, but now it falls through to the LO_SUM case which just considers
> the second operand, not the first (but CONST had a PLUS or MINUS
> in it, not LO_SUM).  I don't have a testcase that broke because of
> this, the bug was found by accident when looking at the function.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk and 4.4?

Ok.

Thanks,
Richard.

> 2009-04-22  Jakub Jelinek  <jakub@redhat.com>
>
>        * alias.c (find_base_term): Move around LO_SUM case, so that
>        CONST falls through into PLUS/MINUS handling.
>
> --- gcc/alias.c.jj      2009-04-21 11:16:28.000000000 +0200
> +++ gcc/alias.c 2009-04-21 12:44:18.000000000 +0200
> @@ -1438,15 +1438,16 @@ find_base_term (rtx x)
>          return x;
>       return 0;
>
> +    case LO_SUM:
> +      /* The standard form is (lo_sum reg sym) so look only at the
> +         second operand.  */
> +      return find_base_term (XEXP (x, 1));
> +
>     case CONST:
>       x = XEXP (x, 0);
>       if (GET_CODE (x) != PLUS && GET_CODE (x) != MINUS)
>        return 0;
>       /* Fall through.  */
> -    case LO_SUM:
> -      /* The standard form is (lo_sum reg sym) so look only at the
> -         second operand.  */
> -      return find_base_term (XEXP (x, 1));
>     case PLUS:
>     case MINUS:
>       {
>
>        Jakub
>

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

end of thread, other threads:[~2009-04-22 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-22 11:22 [PATCH] Fix find_base_term Jakub Jelinek
2009-04-22 11:27 ` Richard Guenther

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).