https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123525

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Robin Dapp <[email protected]>:

https://gcc.gnu.org/g:939dd2324e0f1c7cac49d2635532f08762b67674

commit r16-6742-g939dd2324e0f1c7cac49d2635532f08762b67674
Author: Robin Dapp <[email protected]>
Date:   Mon Jan 12 15:45:46 2026 +0100

    forwprop: Fix type mismatch in vec constructor [PR123525].

    This issue got raised after r16-6671 in which I removed checks for
    number-of-element equality.  In the splat case with conversion:

      vector(16) int w;
      vector(8) long int v;
      _13 = BIT_FIELD_REF <w_12(D), 32, 160>;
      _2 = (long int) _13;
      _3 = (long int) _13;
      ...
      _9 = (long int) _13;
      _1 = {_2, _3, _4, _5, _6, _7, _8, _9};

    right now we do
      _16 = VEC_PERM_EXPR <w_12(D), w_12(D), { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5 }>;
      _17 = VIEW_CONVERT_EXPR<vector(8) intD.6>(_16);

    where the view convert is actually an optimized
      _17 = BIT_FIELD_REF (_16, 512, 0);

    512 is the size of the unconverted source but we should actually use the
    converted source type.  That's what this patch does.

            PR tree-optimization/123525

    gcc/ChangeLog:

            * tree-ssa-forwprop.cc (simplify_vector_constructor): Use
            converted source type for conversion bit field ref.

    gcc/testsuite/ChangeLog:

            * gcc.dg/vect/pr123525.c: New test.
            * g++.dg/vect/pr123525-2.cc: New test.

Reply via email to