https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118976
--- Comment #19 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>: https://gcc.gnu.org/g:7995713012fcc0e0e098157d87fe5ff9d85c820b commit r13-9412-g7995713012fcc0e0e098157d87fe5ff9d85c820b Author: Richard Sandiford <richard.sandif...@arm.com> Date: Wed Mar 5 08:25:55 2025 +0000 Fix folding of BIT_NOT_EXPR for POLY_INT_CST [PR118976] There was an embarrassing typo in the folding of BIT_NOT_EXPR for POLY_INT_CSTs: it used - rather than ~ on the poly_int. Not sure how that happened, but it might have been due to the way that ~x is implemented as -1 - x internally. gcc/ PR tree-optimization/118976 * fold-const.cc (const_unop): Use ~ rather than - for BIT_NOT_EXPR. * config/aarch64/aarch64.cc (aarch64_test_sve_folding): New function. (aarch64_run_selftests): Run it. (cherry picked from commit 78380fd7f743e23dfdf013d68a2f0347e1511550)