On 1/16/26 5:59 AM, Joseph Myers wrote:
On Thu, 15 Jan 2026, Jakub Jelinek wrote:
Hi!
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.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2026-01-15 Jakub Jelinek <[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.
The C front-end changes are OK.
C++ as well.
Jason