[PATCH] Fix s390 delegitimize_address ICE (PR target/48213)
Jakub Jelinek
jakub@redhat.com
Sun Mar 20 19:48:00 GMT 2011
Hi!
My recent PR debug/48043 fix regressed on the following testcase on s390
apparently, the problem is that the clc insn has BLKmode arguments and when
var-tracking tries to canonicalize insns, it will try to delegitimize even
that BLKmode mem/u/c from
(insn 39 45 10 2 (parallel [
(set (reg:CCZ 33 %cc)
(compare:CCZ (mem/s/f:BLK (reg:SI 2 %r2 [ x ]) [3 x_1(D)->s+0 S4 A32])
(mem/u/c:BLK (plus:SI (reg:SI 12 %r12)
(const:SI (unspec:SI [
(symbol_ref:SI ("bar") [flags 0x41] <function_decl 0x7f9b36c2c200 bar>)
] 111))) [0 S4 A8])))
(use (const_int 4 [0x4]))
]) rh689266.i:12 41 {*clc}
(expr_list:REG_DEAD (reg:SI 2 %r2 [ x ])
(nil)))
which crashes because BLKmode subregs aren't allowed.
Fixed thusly, it shouldn't be a big deal for the checking note in
dwarf2out, because generally BLKmode isn't VALUE tracked.
Ok for trunk/4.6?
2011-03-20 Jakub Jelinek <jakub@redhat.com>
PR target/48213
* config/s390/s390.c (s390_delegitimize_address): Don't call
lowpart_subreg if orig_x has BLKmode.
* gcc.dg/pr48213.c: New test.
--- gcc/config/s390/s390.c.jj 2011-03-14 14:11:52.000000000 +0100
+++ gcc/config/s390/s390.c 2011-03-20 20:08:28.000000000 +0100
@@ -5045,6 +5045,8 @@ s390_delegitimize_address (rtx orig_x)
if (GET_MODE (orig_x) != Pmode)
{
+ if (GET_MODE (orig_x) == BLKmode)
+ return orig_x;
y = lowpart_subreg (GET_MODE (orig_x), y, Pmode);
if (y == NULL_RTX)
return orig_x;
--- gcc/testsuite/gcc.dg/pr48213.c.jj 2011-03-20 20:31:14.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr48213.c 2011-03-20 20:30:34.000000000 +0100
@@ -0,0 +1,14 @@
+/* PR target/48213 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2" } */
+/* { dg-options "-g -O2 -fpic" { target fpic } } */
+
+struct S { int (*s) (void); };
+int bar (void);
+
+void
+foo (struct S *x)
+{
+ if (x->s != bar)
+ bar ();
+}
Jakub
More information about the Gcc-patches
mailing list