]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/29319 (ICE unrecognizable insn: offset too large for larl (breaks glibc))
authorMichael Matz <matz@suse.de>
Mon, 27 Nov 2006 16:34:19 +0000 (16:34 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Mon, 27 Nov 2006 16:34:19 +0000 (16:34 +0000)
2006-11-27  Michael Matz  <matz@suse.de>
            Andreas Krebbel  <krebbel1@de.ibm.com>

PR target/29319
* config/s390/predicates.md (larl_operand): Check addend of larl
operand to be in range of -/+2GB.
* config/s390/s390.c (legitimize_pic_address): Likewise.
Changed type of variable even to HOST_WIDE_INT.

2006-11-27  Michael Matz  <matz@suse.de>
            Andreas Krebbel  <krebbel1@de.ibm.com>

PR target/29319
* gcc.dg/20061127-1.c: New testcase.

Co-Authored-By: Andreas Krebbel <krebbel1@de.ibm.com>
From-SVN: r119256

gcc/ChangeLog
gcc/config/s390/predicates.md
gcc/config/s390/s390.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20061127-1.c [new file with mode: 0644]

index 5e1c96767c15c0a79c88e042c22039a8fce3b27b..fcfffec4eddb61fe2c3b6c3077df938fcde7c2ec 100644 (file)
@@ -1,3 +1,12 @@
+2006-11-27  Michael Matz  <matz@suse.de>
+            Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       PR target/29319
+       * config/s390/predicates.md (larl_operand): Check addend of larl
+       operand to be in range of -/+2GB.
+       * config/s390/s390.c (legitimize_pic_address): Likewise.  
+       Changed type of variable even to HOST_WIDE_INT.
+
 2006-11-27  Jan Hubicka  <jh@suse.cz>
 
        * expr.c (emit_block_move_via_libcall): Export.
index 5f9e8d4389205322920c539e45f3152a55df9e40..9f7ea360f6e8fabb6f5f25c8b35f40e3e1e8bb2a 100644 (file)
       if (GET_CODE (XEXP (op, 1)) != CONST_INT
           || (INTVAL (XEXP (op, 1)) & 1) != 0)
         return false;
-      if (INTVAL (XEXP (op, 1)) >= (HOST_WIDE_INT)1 << 32
-         || INTVAL (XEXP (op, 1)) < -((HOST_WIDE_INT)1 << 32))
+      if (INTVAL (XEXP (op, 1)) >= (HOST_WIDE_INT)1 << 31
+         || INTVAL (XEXP (op, 1)) < -((HOST_WIDE_INT)1 << 31))
         return false;
       op = XEXP (op, 0);
     }
index cfe959e88f0ea20e5edcb0eee980b7657c79e5f9..f7a1902ade38a53a6baff4d6ec806321b71a3641 100644 (file)
@@ -3020,7 +3020,10 @@ legitimize_pic_address (rtx orig, rtx reg)
                || (GET_CODE (op0) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (op0)))
              && GET_CODE (op1) == CONST_INT)
            {
-              if (TARGET_CPU_ZARCH && larl_operand (op0, VOIDmode))
+              if (TARGET_CPU_ZARCH
+                 && larl_operand (op0, VOIDmode)
+                 && INTVAL (op1) < (HOST_WIDE_INT)1 << 31
+                 && INTVAL (op1) >= -((HOST_WIDE_INT)1 << 31))
                 {
                   if (INTVAL (op1) & 1)
                     {
@@ -3030,7 +3033,7 @@ legitimize_pic_address (rtx orig, rtx reg)
 
                       if (!DISP_IN_RANGE (INTVAL (op1)))
                         {
-                          int even = INTVAL (op1) - 1;
+                          HOST_WIDE_INT even = INTVAL (op1) - 1;
                           op0 = gen_rtx_PLUS (Pmode, op0, GEN_INT (even));
                          op0 = gen_rtx_CONST (Pmode, op0);
                           op1 = const1_rtx;
index 77ee0300a8a9f39cebba0b85cf3d4b087556e5f3..d2b7adfe62d4abf16113234745a24d9118399aee 100644 (file)
@@ -1,3 +1,9 @@
+2006-11-27  Michael Matz  <matz@suse.de>
+            Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       PR target/29319
+       * gcc.dg/20061127-1.c: New testcase.
+
 2006-11-27  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/20061124-1.c: Add exit() function prototype.
diff --git a/gcc/testsuite/gcc.dg/20061127-1.c b/gcc/testsuite/gcc.dg/20061127-1.c
new file mode 100644 (file)
index 0000000..ec94dc8
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-O1 -fPIC" } */
+
+/* PR target/29319 */
+
+extern void abort(void);
+static char l_info[100];
+
+void
+bug1 (unsigned long tag)
+{
+  char *info = l_info;
+  info[tag - 0x100000000 + 1] = 1;
+}
+
+void
+bug2 (unsigned long tag)
+{
+  char *info = l_info;
+  info[tag - 0x700000000 + 2] = 2;
+}
+
+void
+bug3 (unsigned long tag)
+{
+  char *info = l_info;
+  info[tag - 0x100000000 + 1] = 3;
+}