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

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

https://gcc.gnu.org/g:3556beac9c893a136a449be2df3618a833b743e0

commit r16-6817-g3556beac9c893a136a449be2df3618a833b743e0
Author: Jakub Jelinek <[email protected]>
Date:   Fri Jan 16 11:03:18 2026 +0100

    c, c++: Fix vector enum division handling [PR123437]

    To my surprise we accept generic vectors with enumeral element
    types (unlike e.g. _Complex) and we don't actually try to
    perform "integral" promotions for those either (which for scalars
    promotes ENUMERAL_TYPE operands to their underlying type or
    promoted underlying type).  I'm afraid it is inappropriate
    to change the promotions at this point in stage4, that would
    be a significant user visible change (though sure for a feature
    that hopefully nobody actually uses).  Anyway, in GCC 16
    development some assertions that RDIV_EXPR is only used for floating
    (scalar/vector/complex) operands were added and those now trigger
    on trying to divide vectors where both operands are enum vectors.
    THis is due to the FEs using RDIV_EXPR instead of TRUNC_DIV_EXPR
    when the operands (after promotions) don't have INTEGER_TYPE (or for C
    BITINT_TYPE) operands.

    This patch just adds vector enum to that.

    2026-01-16  Jakub Jelinek  <[email protected]>
                Peter Damianov  <[email protected]>

            PR c/123437
            * c-typeck.cc (build_binary_op): Don't use RDIV_EXPR
            resultcode if both types are integral, _BitInt or
            newly VECTOR_TYPE of ENUMERAL_TYPE.

            * typeck.cc (cp_build_binary_op): Don't use RDIV_EXPR
            resultcode if both types are integral, _BitInt or
            newly VECTOR_TYPE of ENUMERAL_TYPE.

            * c-c++-common/pr123437.c: New test.

Reply via email to