This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix s390_delegitimize_address (PR debug/48043)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 10 Mar 2011 16:11:23 +0100
- Subject: [PATCH] Fix s390_delegitimize_address (PR debug/48043)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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