public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix s390_delegitimize_address (PR debug/48043)
Date: Thu, 10 Mar 2011 15:11:00 -0000	[thread overview]
Message-ID: <20110310151123.GP30899@tyan-ft48-01.lab.bos.redhat.com> (raw)

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

             reply	other threads:[~2011-03-10 15:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 15:11 Jakub Jelinek [this message]
2011-03-10 18:05 ` Andreas Krebbel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110310151123.GP30899@tyan-ft48-01.lab.bos.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=krebbel@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).