re PR target/58067 (ICE in GFortran recog.c:2158)
authorJakub Jelinek <jakub@redhat.com>
Wed, 14 Aug 2013 09:09:58 +0000 (11:09 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 14 Aug 2013 09:09:58 +0000 (11:09 +0200)
PR target/58067
* config/i386/i386.c (ix86_delegitimize_address): For CM_MEDIUM_PIC
and CM_LARGE_PIC ix86_cmodel fall thru into the -m32 code, handle
there also UNSPEC_PLTOFF.

Co-Authored-By: Alexandre Oliva <aoliva@redhat.com>
From-SVN: r201720

gcc/ChangeLog
gcc/config/i386/i386.c

index 8dc071d..0715f74 100644 (file)
@@ -1,3 +1,11 @@
+2013-08-14  Jakub Jelinek  <jakub@redhat.com>
+           Alexandre Oliva  <aoliva@redhat.com>
+
+       PR target/58067
+       * config/i386/i386.c (ix86_delegitimize_address): For CM_MEDIUM_PIC
+       and CM_LARGE_PIC ix86_cmodel fall thru into the -m32 code, handle
+       there also UNSPEC_PLTOFF.
+
 2013-08-14  Marek Polacek  <polacek@redhat.com>
 
        * ipa-inline-analysis.c (add_clause): Avoid shifting integer
index e3f345a..dd1a6a8 100644 (file)
@@ -14124,21 +14124,29 @@ ix86_delegitimize_address (rtx x)
            x = replace_equiv_address_nv (orig_x, x);
          return x;
        }
-      if (GET_CODE (x) != CONST
-         || GET_CODE (XEXP (x, 0)) != UNSPEC
-         || (XINT (XEXP (x, 0), 1) != UNSPEC_GOTPCREL
-             && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL)
-         || (!MEM_P (orig_x) && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL))
-       return ix86_delegitimize_tls_address (orig_x);
-      x = XVECEXP (XEXP (x, 0), 0, 0);
-      if (GET_MODE (orig_x) != GET_MODE (x) && MEM_P (orig_x))
+
+      if (GET_CODE (x) == CONST
+         && GET_CODE (XEXP (x, 0)) == UNSPEC
+         && (XINT (XEXP (x, 0), 1) == UNSPEC_GOTPCREL
+             || XINT (XEXP (x, 0), 1) == UNSPEC_PCREL)
+         && (MEM_P (orig_x) || XINT (XEXP (x, 0), 1) == UNSPEC_PCREL))
        {
-         x = simplify_gen_subreg (GET_MODE (orig_x), x,
-                                  GET_MODE (x), 0);
-         if (x == NULL_RTX)
-           return orig_x;
+         x = XVECEXP (XEXP (x, 0), 0, 0);
+         if (GET_MODE (orig_x) != GET_MODE (x) && MEM_P (orig_x))
+           {
+             x = simplify_gen_subreg (GET_MODE (orig_x), x,
+                                      GET_MODE (x), 0);
+             if (x == NULL_RTX)
+               return orig_x;
+           }
+         return x;
        }
-      return x;
+
+      if (ix86_cmodel != CM_MEDIUM_PIC && ix86_cmodel != CM_LARGE_PIC)
+       return ix86_delegitimize_tls_address (orig_x);
+
+      /* Fall thru into the code shared with -m32 for -mcmodel=large -fpic
+        and -mcmodel=medium -fpic.  */
     }
 
   if (GET_CODE (x) != PLUS
@@ -14175,10 +14183,12 @@ ix86_delegitimize_address (rtx x)
 
   if (GET_CODE (x) == UNSPEC
       && ((XINT (x, 1) == UNSPEC_GOT && MEM_P (orig_x) && !addend)
-         || (XINT (x, 1) == UNSPEC_GOTOFF && !MEM_P (orig_x))))
+         || (XINT (x, 1) == UNSPEC_GOTOFF && !MEM_P (orig_x))
+         || (XINT (x, 1) == UNSPEC_PLTOFF && ix86_cmodel == CM_LARGE_PIC
+             && !MEM_P (orig_x) && !addend)))
     result = XVECEXP (x, 0, 0);
 
-  if (TARGET_MACHO && darwin_local_data_pic (x)
+  if (!TARGET_64BIT && TARGET_MACHO && darwin_local_data_pic (x)
       && !MEM_P (orig_x))
     result = XVECEXP (x, 0, 0);