public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix s390_delegitimize_address (PR debug/48043)
@ 2011-03-10 15:11 Jakub Jelinek
  2011-03-10 18:05 ` Andreas Krebbel
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2011-03-10 15:11 UTC (permalink / raw)
  To: Andreas Krebbel; +Cc: gcc-patches

Hi!

The pr47201.c testcase ICEs on s390x-linux during var-tracking.
The problem is that s390_delegitimize_address delegitimizes:
(mem/u/c:SF (plus:SI (reg:SI 12 %r12) (const:SI (unspec:SI [(symbol_ref:SI ("u")  <var_decl 0x7fc1ff23f000 u>)] 111))) [0 S4 A8])
into:
(symbol_ref:SI ("u")  <var_decl 0x7fc1ff23f000 u>)
Note the different mode.  This means we end up after var-tracking.c
(adjust_insn) temporarily with a
(set (reg:SF 17 %f2) (symbol_ref:SI ("u") <var_decl 0x7fc1ff23f000 u>))
insn and things go wrong pretty quickly because of the mode mismatch.
This is the same issue as i?86 backend had:
http://gcc.gnu.org/ml/gcc-patches/2010-05/msg00133.html

Andreas has bootstrapped/regtested this.

Ok for trunk?

2011-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR debug/48043
	* config/s390/s390.c (s390_delegitimize_address): Make sure the                                                                            
	result mode matches original rtl mode.

--- gcc/config/s390/s390.c.jj	2011-03-09 19:54:56.000000000 +0100
+++ gcc/config/s390/s390.c	2011-03-09 21:34:52.000000000 +0100
@@ -5027,20 +5027,29 @@ s390_delegitimize_address (rtx orig_x)
       y = XEXP (XEXP (x, 1), 0);
       if (GET_CODE (y) == UNSPEC
 	  && XINT (y, 1) == UNSPEC_GOT)
-	return XVECEXP (y, 0, 0);
-      return orig_x;
+	y = XVECEXP (y, 0, 0);
+      else
+	return orig_x;
     }
-
-  if (GET_CODE (x) == CONST)
+  else if (GET_CODE (x) == CONST)
     {
       y = XEXP (x, 0);
       if (GET_CODE (y) == UNSPEC
 	  && XINT (y, 1) == UNSPEC_GOTENT)
-	return XVECEXP (y, 0, 0);
-      return orig_x;
+	y = XVECEXP (y, 0, 0);
+      else
+	return orig_x;
     }
+  else
+    return orig_x;
 
-  return orig_x;
+  if (GET_MODE (orig_x) != Pmode)
+    {
+      y = lowpart_subreg (GET_MODE (orig_x), y, Pmode);
+      if (y == NULL_RTX)
+	return orig_x;
+    }
+  return y;
 }
 
 /* Output operand OP to stdio stream FILE.

	Jakub

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

* Re: [PATCH] Fix s390_delegitimize_address (PR debug/48043)
  2011-03-10 15:11 [PATCH] Fix s390_delegitimize_address (PR debug/48043) Jakub Jelinek
@ 2011-03-10 18:05 ` Andreas Krebbel
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Krebbel @ 2011-03-10 18:05 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On 03/10/2011 04:11 PM, Jakub Jelinek wrote:
> Ok for trunk?
> 
> 2011-03-09  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR debug/48043
> 	* config/s390/s390.c (s390_delegitimize_address): Make sure the                                                                            
> 	result mode matches original rtl mode.

This is ok. Thanks!

-Andreas-

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

end of thread, other threads:[~2011-03-10 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-10 15:11 [PATCH] Fix s390_delegitimize_address (PR debug/48043) Jakub Jelinek
2011-03-10 18:05 ` Andreas Krebbel

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