https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115707
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Feng Xue <f...@gcc.gnu.org>: https://gcc.gnu.org/g:3c089ee5d5a86cab0b27c69b96c4354c496520ac commit r15-2737-g3c089ee5d5a86cab0b27c69b96c4354c496520ac Author: Feng Xue <f...@os.amperecomputing.com> Date: Mon Aug 5 15:23:56 2024 +0800 vect: Allow unsigned-to-signed promotion in vect_look_through_possible_promotion [PR115707] The function fails to figure out root definition if casts involves more than two promotions with sign change as: long a = (long)b; // promotion cast -> int b = (int)c; // promotion cast, sign change -> unsigned short c = ...; For this case, the function thinks the 2nd cast has different sign as the 1st, so stop looking through, while "unsigned short -> integer" is a nature sign extension. 2024-08-05 Feng Xue <f...@os.amperecomputing.com> gcc/ PR tree-optimization/115707 * tree-vect-patterns.cc (vect_look_through_possible_promotion): Allow unsigned-to-signed promotion.