summaryrefslogtreecommitdiff
path: root/gcc/config/i386
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-27 17:35:14 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-27 17:35:14 +0000
commit5ee52e91abe11464113b9dcea4c939ceeb8356ac (patch)
tree92ca956383077c14ed2dba324842ea3408e4f0c1 /gcc/config/i386
parente9d9a6a293901e9286ca9b7bf5ea9ed2623d35aa (diff)
downloadgcc-5ee52e91abe11464113b9dcea4c939ceeb8356ac.tar.gz
PR target/65593
* config/i386/i386.c (legitimize_pic_address): If base is SYMBOL_REF or LABEL_REF using %rip addressing, force it to reg to avoid PLUS of SYMBOL_REF/LABEL_REF and register. * gcc.c-torture/compile/pr65593.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221741 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386')
-rw-r--r--gcc/config/i386/i386.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 22bc81f165a..862bda529b8 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -13881,6 +13881,12 @@ legitimize_pic_address (rtx orig, rtx reg)
}
else
{
+ /* For %rip addressing, we have to use just disp32, not
+ base nor index. */
+ if (TARGET_64BIT
+ && (GET_CODE (base) == SYMBOL_REF
+ || GET_CODE (base) == LABEL_REF))
+ base = force_reg (mode, base);
if (GET_CODE (new_rtx) == PLUS
&& CONSTANT_P (XEXP (new_rtx, 1)))
{