On 1/15/2026 3:40 PM, Jakub Jelinek wrote:
On Thu, Jan 15, 2026 at 12:25:07PM -0800, Andrew Pinski wrote:
gcc/c/ChangeLog:
PR c/123437
* c-typeck.cc (build_binary_op): Include ENUMERAL_TYPE in
integer division check for vectors.
gcc/cp/ChangeLog:
PR c/123437
* typeck.cc (cp_build_binary_op): Include ENUMERAL_TYPE in
integer division check.
gcc/testsuite/ChangeLog:
PR c/123437
* c-c++-common/pr123437.c: New test.
I think Jakub's comment probably points to a slightly better patch. In
particular his patch/comment only allow the ENUMERAL_TYPE for tcode
when the code is a VECTOR_TYPE. Seems safer at this point.
OK with that change (which I think makes it idential to Jakub's patch in
c#5 in the bugzilla case.
Jakub posted his patch here already:
https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705874.html
I'm sorry I have missed Peter's patch being posted to gcc-patches,
the "WDYT the solution should be?" in bugzilla made me think it is not.
Anyway, the testcase posted by Peter will suffer from -Wpsabi warnings
e.g. on i686-linux, so I think it is better to avoid vector arguments/return
values when we can (and we can in this case).
If we want to go with my version, I can add Peter as Co-Authored-By
on the commit.
Yes, I think we want to go with your patch version. The testcase might
need minor adjustment, but the core patch, yours looks best to me.
jeff