https://gcc.gnu.org/g:c21bc4887dec4204dfdfa7687a2e3b35306c6f04
commit r17-4145-gc21bc4887dec4204dfdfa7687a2e3b35306c6f04 Author: Richard Sandiford <[email protected]> Date: Thu Sep 10 21:56:27 2026 +0100 pdp11: Avoid a maybe-uninitialized warning 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. gcc/ * config/pdp11/pdp11.cc (pdp11_rtx_costs): Move src assignment into the blocks that need it. Diff: --- 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 f8fe020b2467..e34064ffa41b 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)) {
