On Fri, Nov 13, 2026 at 08:20:27PM +0100, Torbjörn SVENSSON wrote:
> I reported this failure earlier today in
> https://gcc.gnu.org/pipermail/gcc-patches/2026-November/738737.html
>
> Tonight, I had some more spare time, so I took another look and checked what
> the test is really testing. I don't know why -1/-1 was selected, but since
> 0/-1
> is the only valid expression (the only one without UB), I suppose we can
> change
> to that.
>
> Tested on arm-none-eabi, using r17-6056-g9adb420e4826a6 as the baseline.
>
> Ok for trunk?
No, that looks incorrect. The test uses -fwrapv, I believe that makes
~0wb / ~0wb - ~0wb. Without -fwrapv it is obviously UB.
Same thing as whether ()-__INT_MAX__ - 1) / -1 is UB with -fwrapv or not.
Jakub