https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123807
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Xi Ruoyao <[email protected]>: https://gcc.gnu.org/g:89e6b4902e850d350ead6f11eaf4dd6a98b8c715 commit r14-12343-g89e6b4902e850d350ead6f11eaf4dd6a98b8c715 Author: Xi Ruoyao <[email protected]> Date: Thu Feb 26 11:55:22 2026 +0800 middle-end: extend the narrower shift amount before broadcasting it [PR 124250] The comment above expand_vector_broadcast() states a precondition that the mode of op must be the element mode of vmode. But when expand_binop() called expand_vector_broadcast() to broadcast the shift amount, it only truncated the shift amount if it's too wide, but no action is performed if the shift amount is too narrow. Note that the assertion in expand_vector_broadcast is deliberately skipped in the backport, in order not to wake up latent "harmless" bugs. PR middle-end/124250 PR target/123807 gcc/ * optabs.cc (expand_binop): Extend the shift amount if it's narrower than the element of the shifted vector. gcc/testsuite/ * gcc.c-torture/compile/pr124250.c: New test. (cherry picked from commit 1139fdadc85a0b602a2833e6b7f2cfe2a8a90cdb)
