https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111648
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Prathamesh Kulkarni <prathamesh3...@gcc.gnu.org>: https://gcc.gnu.org/g:3ec8ecb8e92faec889bc6f7aeac9ff59e82b4f7f commit r14-4726-g3ec8ecb8e92faec889bc6f7aeac9ff59e82b4f7f Author: Prathamesh Kulkarni <prathamesh.kulka...@linaro.org> Date: Thu Oct 19 00:29:38 2023 +0530 PR111648: Fix wrong code-gen due to incorrect VEC_PERM_EXPR folding. gcc/ChangeLog: PR tree-optimization/111648 * fold-const.cc (valid_mask_for_fold_vec_perm_cst_p): If a1 chooses base element from arg, ensure that it's a natural stepped sequence. (build_vec_cst_rand): New param natural_stepped and use it to construct a naturally stepped sequence. (test_nunits_min_2): Add new unit tests Case 6 and Case 7.