https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116514
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:e7d5b9aa021f6fc32810670b18ffabe543262775 commit r15-3548-ge7d5b9aa021f6fc32810670b18ffabe543262775 Author: Richard Biener <rguent...@suse.de> Date: Wed Aug 28 14:06:48 2024 +0200 tree-optimization/116514 - handle pointer difference in bit-CCP When evaluating the difference of two aligned pointers in CCP we fail to handle the EXACT_DIV_EXPR by the element size that occurs. The testcase then also exercises modulo to test alignment but modulo by a power-of-two isn't handled either. PR tree-optimization/116514 * tree-ssa-ccp.cc (bit_value_binop): Handle EXACT_DIV_EXPR like TRUNC_DIV_EXPR. Handle exact division of a signed value by a power-of-two like a shift. Handle unsigned division by a power-of-two like a shift. Handle unsigned TRUNC_MOD_EXPR by power-of-two, handle signed TRUNC_MOD_EXPR by power-of-two if the result is zero. * gcc.dg/tree-ssa/ssa-ccp-44.c: New testcase.