https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120059
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This semi obvious patch fixes it. The only thing I am not 100% sure yet is why is simplify_gen_subreg failing; but yes simplify_gen_subreg is known in some cases to return NULL. ``` diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index 7c4d8e6cfdb..7bcbe11370f 100644 --- a/gcc/simplify-rtx.cc +++ b/gcc/simplify-rtx.cc @@ -3063,6 +3063,10 @@ simplify_with_subreg_not (rtx_code binop, machine_mode mode, rtx op0, rtx op1) XEXP (SUBREG_REG (opn), 0), GET_MODE (SUBREG_REG (opn)), SUBREG_BYTE (opn)); + + if (!new_subreg) + return NULL_RTX; + rtx new_not = simplify_gen_unary (NOT, mode, new_subreg, mode); if (opn == op0) return simplify_gen_binary (binop, mode, new_not, op1); ```