pdp11_rtx_costs has:

  if (GET_RTX_LENGTH (code) > 1)
    src = XEXP (x, 1);

followed by uses of src that are gated on GET_CODE.  GET_RTX_LENGTH
internally uses a static table whose contents are defined in rtl.cc.

This means that, when compiling pdp11.cc, the compiler doesn't know
what value GET_RTX_LENGTH has for a given GET_CODE.  It therefore
flags src as being potentially uninitialised.

There are only two places that use src, so it seemed easier to copy
the assignment to both places.

This fixes pdp11 builds with config-list.mk.

Tested with config-list.mk.  OK to install?

Richard


gcc/
        * config/pdp11/pdp11.cc (pdp11_rtx_costs): Move src assignment
        into the blocks that need it.
---
 gcc/config/pdp11/pdp11.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/pdp11/pdp11.cc b/gcc/config/pdp11/pdp11.cc
index f8fe020b246..e34064ffa41 100644
--- a/gcc/config/pdp11/pdp11.cc
+++ b/gcc/config/pdp11/pdp11.cc
@@ -1023,8 +1023,6 @@ pdp11_rtx_costs (rtx x, machine_mode mode, int outer_code,
        *total = 2;
       return true;
     }
-  if (GET_RTX_LENGTH (code) > 1)
-    src = XEXP (x, 1);
   dest = XEXP (x, 0);
 
   /* If optimizing for size, claim everything costs 2 per word, plus
@@ -1098,6 +1096,7 @@ pdp11_rtx_costs (rtx x, machine_mode mode, int outer_code,
      continue accordingly to handle the operands.  */
   if (code == SET)
     {
+      src = XEXP (x, 1);
       switch (GET_CODE (src))
        {
        case REG:
@@ -1122,6 +1121,7 @@ pdp11_rtx_costs (rtx x, machine_mode mode, int outer_code,
     }
   else if (code == PLUS || code == MINUS)
     {
+      src = XEXP (x, 1);
       if (GET_CODE (src) == CONST_INT &&
          (INTVAL (src) == 1 || INTVAL (src) == -1))
        {
-- 
2.55.0

Reply via email to