diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7c757c0ef41..08a0c08946d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-08-24 Segher Boessenkool + + PR target/86989 + * config/rs6000/rs6000.c (toc_relative_expr_p): Check that the base is + the TOC register. + 2018-08-24 Aldy Hernandez PR 87073/bootstrap diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 252d197a746..ecaf0718ca7 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -7943,7 +7943,9 @@ toc_relative_expr_p (const_rtx op, bool strict, const_rtx *tocrel_base_ret, *tocrel_offset_ret = tocrel_offset; return (GET_CODE (tocrel_base) == UNSPEC - && XINT (tocrel_base, 1) == UNSPEC_TOCREL); + && XINT (tocrel_base, 1) == UNSPEC_TOCREL + && REG_P (XVECEXP (tocrel_base, 0, 1)) + && REGNO (XVECEXP (tocrel_base, 0, 1)) == TOC_REGISTER); } /* Return true if X is a constant pool address, and also for cmodel=medium