https://gcc.gnu.org/g:563c0e2bcca3940b3a60e8d18bb8338d356de357
commit 563c0e2bcca3940b3a60e8d18bb8338d356de357 Author: Jeff Law <[email protected]> Date: Mon Nov 3 12:46:23 2025 -0700 [PR rtl-optimization/122536] Fix guard against variable bit extracts in RTL simplifier While I haven't been able to reproduce the failure Sam reported, based on the RTL checking failure point and the code in question it was pretty clear the code that was supposed to guard against a variable bit extract was just checking the wrong argument to verify it was a constant integer -- it missed a level of XEXP object extraction. I passed this patch along to Sam and he verified it fixes his kernel build. I've bootstrapped and regression tested on x86_64. Pushing to the trunk. Pushing to the trunk. PR rtl-optimization/122536 gcc/ * simplify-rtx.cc (simplify_context::simplify_binary_operation_1): Fix guard against variable bit extracts in recent change. (cherry picked from commit 0f4afd8bb164054c227b2678169c0b098479a753) Diff: --- gcc/simplify-rtx.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index 7220fc59eb7b..2f9a1d369dad 100644 --- a/gcc/simplify-rtx.cc +++ b/gcc/simplify-rtx.cc @@ -3633,8 +3633,8 @@ simplify_context::simplify_binary_operation_1 (rtx_code code, && XEXP (op0, 1) == CONST1_RTX (mode) && XEXP (op1, 1) == CONST1_RTX (mode) /* Verify bit positions (for cases with variable bit position). */ - && CONST_INT_P (XEXP (op0, 1)) - && CONST_INT_P (XEXP (op1, 1))) + && CONST_INT_P (XEXP (XEXP (op0, 0), 1)) + && CONST_INT_P (XEXP (XEXP (op1, 0), 1))) { unsigned HOST_WIDE_INT bitpos1 = INTVAL (XEXP (XEXP (op0, 0), 1)); unsigned HOST_WIDE_INT bitpos2 = INTVAL (XEXP (XEXP (op1, 0), 1)); @@ -3665,7 +3665,7 @@ simplify_context::simplify_binary_operation_1 (rtx_code code, && XEXP (op0, 1) == CONST1_RTX (mode) && XEXP (op1, 1) == CONST0_RTX (mode) /* Verify bit position. */ - && CONST_INT_P (XEXP (op0, 1))) + && CONST_INT_P (XEXP (XEXP (op0, 0), 1))) { unsigned HOST_WIDE_INT bitpos1 = INTVAL (XEXP (XEXP (op0, 0), 1)); unsigned HOST_WIDE_INT mask
