I suspect this is papering over a real problem, but I've been applying this workaround locally to keep my valgrind output clean.
gcc/ChangeLog: PR/64003 * final.c (shorten_branches): Allocate insn_lengths with XCNEWVEC rather than XNEWVEC; remove subsequent per-element initialization. --- gcc/final.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/final.c b/gcc/final.c index c3805c9..53b0e86 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1019,7 +1019,7 @@ shorten_branches (rtx_insn *first) return; /* Allocate the rest of the arrays. */ - insn_lengths = XNEWVEC (int, max_uid); + insn_lengths = XCNEWVEC (int, max_uid); insn_lengths_max_uid = max_uid; /* Syntax errors can lead to labels being outside of the main insn stream. Initialize insn_addresses, so that we get reproducible results. */ @@ -1127,8 +1127,6 @@ shorten_branches (rtx_insn *first) { uid = INSN_UID (insn); - insn_lengths[uid] = 0; - if (LABEL_P (insn)) { int log = LABEL_TO_ALIGNMENT (insn); -- 1.8.5.3