https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128196
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jeff Law <[email protected]>: https://gcc.gnu.org/g:aac1795891f408893e4e3c54275e1444defb1728 commit r17-6783-gaac1795891f408893e4e3c54275e1444defb1728 Author: Xionghu Luo <[email protected]> Date: Sat Nov 28 11:47:25 2026 -0700 [PATCH] tree-optimization/128196: do not record strnlen as the full string length strnlen returns min (strlen (src), bound). When a strinfo already held only a lower bound, handle_builtin_strlen installed that result as the full string length, so a later strlen reused the bound. Record the full length only for strlen, matching the new_strinfo path from PR86204. Bootstrapped on x86_64-pc-linux-gnu. Regression tested with make -k check. Assisted-by: Cursor Grok Co-authored-by: Cursor <[email protected]> gcc/ChangeLog: PR tree-optimization/128196 * tree-ssa-strlen.cc (strlen_pass::handle_builtin_strlen): Do not record a strnlen result as the full string length. gcc/testsuite/ChangeLog: PR tree-optimization/128196 * gcc.dg/strlenopt-98.c: New test.
