OSDN Git Service

* i386.c (legitimate_address_p): Accept other bases than
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Aug 2000 14:28:14 +0000 (14:28 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Aug 2000 14:28:14 +0000 (14:28 +0000)
pic_offset_table_rtx for GOTOFF constructs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35424 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 90f51cc..503f008 100644 (file)
@@ -1,3 +1,8 @@
+Wed Aug  2 16:26:15 MET DST 2000  Jan Hubicka  <jh@suse.cz>
+
+       * i386.c (legitimate_address_p): Accept other bases than
+       pic_offset_table_rtx for GOTOFF constructs.
+
 Wed Aug  2 15:59:34 MET DST 2000  Jan Hubicka  <jh@suse.cz>
 
        * i386.md (shift to lea splitter): Use const_int_operand.
index c5289ab..68a78e9 100644 (file)
@@ -2506,14 +2506,27 @@ legitimate_address_p (mode, addr, strict)
              goto error;
            }
 
-         /* Verify that a symbolic pic displacement includes 
-            the pic_offset_table_rtx register.  */
-         if (base != pic_offset_table_rtx
-             && (index != pic_offset_table_rtx || scale != 1))
-           {
-             reason = "pic displacement against invalid base";
-             goto error;
-           }
+          /* This code used to verify that a symbolic pic displacement
+            includes the pic_offset_table_rtx register. 
+           
+            While this is good idea, unfortunately these constructs may
+            be created by "adds using lea" optimization for incorrect
+            code like:
+
+            int a;
+            int foo(int i)
+              {
+                return *(&a+i);
+              }
+
+            This code nonsential, but results in addressing
+            GOT table with pic_offset_table_rtx base.  We can't
+            just refuse it easilly, since it gets matched by
+            "addsi3" pattern, that later gets split to lea in the
+            case output register differs from input.  While this
+            can be handled by separate addsi pattern for this case
+            that never results in lea, this seems to be easier and
+            correct fix for crash to disable this test.  */
        }
       else if (HALF_PIC_P ())
        {