https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939
Xi Ruoyao <xry111 at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #14 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- Fixed at r14-4355: commit 86b2ffc0b8334c86ed13974f7d986821040474a4 Author: Stefan Schulze Frielinghaus <stefa...@linux.ibm.com> Date: Sun Oct 1 16:11:32 2023 +0200 rtl-optimization/110939 Really fix narrow comparison of memory and constant In the former fix in commit 41ef5a34161356817807be3a2e51fbdbe575ae85 I completely missed the fact that the normal form of a CONST_INT for a mode with fewer bits than in HOST_WIDE_INT is a sign extended version of the actual constant. This even holds true for unsigned constants. Fixed by masking out the upper bits for the incoming constant and sign extending the resulting unsigned constant. gcc/ChangeLog: * combine.cc (simplify_compare_const): Properly handle unsigned constants while narrowing comparison of memory and constants.