https://gcc.gnu.org/g:4439a419398e832eb092d8c90ab62356281db916
commit r17-5448-g4439a419398e832eb092d8c90ab62356281db916 Author: Jakub Jelinek <[email protected]> Date: Wed Oct 21 12:32:48 2026 +0200 cfgrtl: Fix rtl checking bootstrap broken by r17-5363 On Mon, Oct 19, 2026 at 05:15:02PM -0400, [email protected] wrote: > @@ -1667,10 +1667,10 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label) > for (int i = 0; i < n; ++i) > if (XEXP (ASM_OPERANDS_LABEL (note, i), 0) == BB_HEAD (e->dest)) > { > - LABEL_NUSES (XEXP (ASM_OPERANDS_LABEL (note, i), 0))--; > + LABEL_NUSES (label_ref_label (ASM_OPERANDS_LABEL (note, i)))--; > XEXP (ASM_OPERANDS_LABEL (note, i), 0) > = block_label (jump_block); > - LABEL_NUSES (XEXP (ASM_OPERANDS_LABEL (note, i), 0))++; > + LABEL_NUSES (label_ref_label (ASM_OPERANDS_LABEL (note, i)))++; > } > > rtx_insn *insn = BB_END (new_edge->src); I think this change broke rtl checking bootstrap on x86_64-linux and i686-linux, I'm now getting In file included from ../../gcc/cfgrtl.cc:45: ../../gcc/cfgrtl.cc: In function ‘basic_block_def* force_nonfallthru_and_redirect(edge, basic_block, rtx)’: ../../gcc/rtl.h:732:53: error: ‘note’ may be used uninitialized [-Werror=maybe-uninitialized] 732 | #define GET_CODE(RTX) ((enum rtx_code) (RTX)->code) | ~~~~~~~^~~~ ../../gcc/rtl.h:1121:35: note: in definition of macro ‘RTL_CHECKC1’ 1121 | (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \ | ^~~ ../../gcc/rtl.h:1839:26: note: in expansion of macro ‘XCINT’ 1839 | #define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL) | ^~~~~ ../../gcc/cfgrtl.cc:1673:17: note: in expansion of macro ‘LABEL_NUSES’ 1673 | LABEL_NUSES (label_ref_label (ASM_OPERANDS_LABEL (note, i)))++; | ^~~~~~~~~~~ ../../gcc/rtl.h:1409:33: note: in expansion of macro ‘RTVEC_ELT’ 1409 | #define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M) | ^~~~~~~~~ ../../gcc/rtl.h:1122:10: note: in expansion of macro ‘GET_CODE’ 1122 | if (GET_CODE (_rtx) != (C)) \ | ^~~~~~~~ ../../gcc/rtl.h:1402:32: note: in expansion of macro ‘RTL_CHECKC1’ 1402 | #define XCVEC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtvec) | ^~~~~~~~~~~ ../../gcc/rtl.h:1409:44: note: in expansion of macro ‘XCVEC’ 1409 | #define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M) | ^~~~~ ../../gcc/rtl.h:2653:36: note: in expansion of macro ‘XCVECEXP’ 2653 | #define ASM_OPERANDS_LABEL(RTX, N) XCVECEXP (RTX, 5, N, ASM_OPERANDS) | ^~~~~~~~ ../../gcc/cfgrtl.cc:1673:47: note: in expansion of macro ‘ASM_OPERANDS_LABEL’ 1673 | LABEL_NUSES (label_ref_label (ASM_OPERANDS_LABEL (note, i)))++; | ^~~~~~~~~~~~~~~~~~ ../../gcc/cfgrtl.cc:1523:7: note: ‘note’ was declared here 1523 | rtx note; | ^~~~ I think it is a false positive warning, we have rtx note; ... bool asm_goto_edge = false; ... if (JUMP_P (BB_END (e->src)) && target != EXIT_BLOCK_PTR_FOR_FN (cfun) && (e->flags & EDGE_FALLTHRU) && (note = extract_asm_operands (PATTERN (BB_END (e->src))))) { int n = ASM_OPERANDS_LABEL_LENGTH (note); for (int i = 0; i < n; ++i) if (XEXP (ASM_OPERANDS_LABEL (note, i), 0) == BB_HEAD (e->dest)) { asm_goto_edge = true; break; } } if (EDGE_COUNT (e->src->succs) >= 2 || abnormal_edge_flags || asm_goto_edge) ... if (asm_goto_edge) { int n = ASM_OPERANDS_LABEL_LENGTH (note); for (int i = 0; i < n; ++i) if (XEXP (ASM_OPERANDS_LABEL (note, i), 0) == BB_HEAD (e->dest)) { LABEL_NUSES (label_ref_label (ASM_OPERANDS_LABEL (note, i)))--; XEXP (ASM_OPERANDS_LABEL (note, i), 0) = block_label (jump_block); LABEL_NUSES (label_ref_label (ASM_OPERANDS_LABEL (note, i)))++; } so, if asm_goto_edge is set to true, then note should be initialized already, but it might be harder for uninit pass to figure this out, when asm_goto_edge is set inside of a loop. While it is a false positive, I think it is caused by inconsistently in the RTL checking macros, label_ref_label uses XCEXP (x, 0, LABEL_REF), the loop was previously using XEXP (x, 0) 4 times (which doesn't check RTL code but RTL format), but now uses label_ref_label (and thus XCEXP) twice and XEXP twice, for the same thing. The false positive warning goes away if also the remaining two XEXP uses are replaced, one with label_ref_label, one with set_label_ref_label. 2026-10-21 Jakub Jelinek <[email protected]> * cfgrtl.cc (force_nonfallthru_and_redirect): Use label_ref_label and set_label_ref_label calls instead of the remaining two XEXP uses. Reviewed-by: Richard Biener <[email protected]> Diff: --- gcc/cfgrtl.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/cfgrtl.cc b/gcc/cfgrtl.cc index 07ca8830305c..c89f28a51c2a 100644 --- a/gcc/cfgrtl.cc +++ b/gcc/cfgrtl.cc @@ -1665,11 +1665,12 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label) int n = ASM_OPERANDS_LABEL_LENGTH (note); for (int i = 0; i < n; ++i) - if (XEXP (ASM_OPERANDS_LABEL (note, i), 0) == BB_HEAD (e->dest)) + if (label_ref_label (ASM_OPERANDS_LABEL (note, i)) + == BB_HEAD (e->dest)) { LABEL_NUSES (label_ref_label (ASM_OPERANDS_LABEL (note, i)))--; - XEXP (ASM_OPERANDS_LABEL (note, i), 0) - = block_label (jump_block); + set_label_ref_label (ASM_OPERANDS_LABEL (note, i), + block_label (jump_block)); LABEL_NUSES (label_ref_label (ASM_OPERANDS_LABEL (note, i)))++; }
