From: Alan Modra Date: Tue, 24 Feb 2015 00:00:59 +0000 (+1030) Subject: re PR middle-end/65182 (-Wuninitialized fails when pointer to variable later passed... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2397d13c5948e5da5645a952fe444a0cd413e68f;p=gcc.git re PR middle-end/65182 (-Wuninitialized fails when pointer to variable later passed to function (fixed? add testcase?)) PR target/65182 * config/rs6000/rs6000.c (get_memref_parts): Only return true when *base is a reg. Handle nested plus addresses. Simplify pre_modify test. From-SVN: r220924 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 02e60b77dc2..c1e46fb7286 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-02-24 Alan Modra + + PR target/65182 + * config/rs6000/rs6000.c (get_memref_parts): Only return true + when *base is a reg. Handle nested plus addresses. Simplify + pre_modify test. + 2015-02-22 Max Filippov * config/xtensa/xtensa.h (CONSTANT_ALIGNMENT, DATA_ALIGNMENT): diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e482547aecc..6cef0f5a93c 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -27172,25 +27172,21 @@ get_memref_parts (rtx mem, rtx *base, HOST_WIDE_INT *offset, else return false; - if (GET_CODE (XEXP (mem, 0)) == PRE_MODIFY) - addr_rtx = XEXP (XEXP (mem, 0), 1); - else - addr_rtx = (XEXP (mem, 0)); + addr_rtx = (XEXP (mem, 0)); + if (GET_CODE (addr_rtx) == PRE_MODIFY) + addr_rtx = XEXP (addr_rtx, 1); - if (GET_CODE (addr_rtx) == REG) - { - *base = addr_rtx; - *offset = 0; - } - else if (GET_CODE (addr_rtx) == PLUS - && CONST_INT_P (XEXP (addr_rtx, 1))) + *offset = 0; + while (GET_CODE (addr_rtx) == PLUS + && CONST_INT_P (XEXP (addr_rtx, 1))) { - *base = XEXP (addr_rtx, 0); - *offset = INTVAL (XEXP (addr_rtx, 1)); + *offset += INTVAL (XEXP (addr_rtx, 1)); + addr_rtx = XEXP (addr_rtx, 0); } - else + if (!REG_P (addr_rtx)) return false; + *base = addr_rtx; return true; }