https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95443
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by H.J. Lu <h...@gcc.gnu.org>: https://gcc.gnu.org/g:9cba898481368ce16c6a2d30ef781a82dce27c55 commit r11-2068-g9cba898481368ce16c6a2d30ef781a82dce27c55 Author: H.J. Lu <hjl.to...@gmail.com> Date: Mon Jul 13 10:33:47 2020 -0700 x86: Pass a copy of the string length to cmpstrnqi cmpstrnsi expander may pass the actual string length directly to cmpstrnqi patterns. For cmpstrnsi, one of the strings must be a constant and expand_builtin_strncmp rewrites the length argument to be the minimum of the const string length and the actual string length. But it is not the case for cmpmemsi. Pass a copy of the string length to cmpstrnqi patterns to avoid changing the actual string length by cmpstrnqi patterns. gcc/ PR target/95443 * config/i386/i386.md (cmpstrnsi): Pass a copy of the string length to cmpstrnqi patterns. gcc/testsuite/ PR target/95443 * gcc.target/i386/pr95443-1.c: New test. * gcc.target/i386/pr95443-2.c: Likewise.