From f21a589997d17031e4d5169e7ef24f10d59c9530 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 27 Mar 2015 18:35:14 +0100 Subject: [PATCH] re PR target/65593 (internal compiler error: in extract_insn, at recog.c:2343) 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. From-SVN: r221741 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.c | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr65593.c | 4 ++++ 4 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr65593.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 05174d85b65..0fb06d645b8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-03-27 Jakub Jelinek + + 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. + 2015-03-27 Jan Hubicka PR target/65531 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))) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3409c964175..4fb0e221e83 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-27 Jakub Jelinek + + PR target/65593 + * gcc.c-torture/compile/pr65593.c: New test. + 2015-03-27 Paolo Carlini PR c++/59329 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr65593.c b/gcc/testsuite/gcc.c-torture/compile/pr65593.c new file mode 100644 index 00000000000..e72889d6e6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr65593.c @@ -0,0 +1,4 @@ +/* PR target/65593 */ +/* { dg-additional-options "-fpie" { target pie } } */ + +#include "pr20928.c" -- 2.30.2