https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111355
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jiu Fu Guo <guoji...@gcc.gnu.org>: https://gcc.gnu.org/g:4d80863d7f93c0a839d1fe5dc59be83153e89110 commit r14-4192-g4d80863d7f93c0a839d1fe5dc59be83153e89110 Author: Jiufu Guo <guoji...@linux.ibm.com> Date: Wed Sep 20 11:11:58 2023 +0800 check undefine_p for one more vr The root cause of PR111355 and PR111482 is missing to check if vr0 is undefined_p before call vr0.lower_bound. In the pattern "(X + C) / N", (if (INTEGRAL_TYPE_P (type) && get_range_query (cfun)->range_of_expr (vr0, @0)) (if (...) (plus (op @0 @2) { wide_int_to_tree (type, plus_op1 (c)); }) (if (TYPE_UNSIGNED (type) && c.sign_mask () < 0 ... && wi::geu_p (vr0.lower_bound (), -c)) In "(if (...)", there is code to prevent vr0's undefined_p, But in the "else" part, vr0's undefined_p is not checked before "wi::geu_p (vr0.lower_bound (), -c)". PR tree-optimization/111355 gcc/ChangeLog: * match.pd ((X + C) / N): Update pattern. gcc/testsuite/ChangeLog: * gcc.dg/pr111355.c: New test.