[Bug ada/122063] unexpected overflow check before fixed-point multiplication

dvraaij at pm dot me gcc-bugzilla@gcc.gnu.org
Thu Oct 30 18:12:00 GMT 2025


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

--- Comment #4 from Dennis van Raaij <dvraaij at pm dot me> ---
With the fix and an additional cast to Q32_0 like so

   return Unsigned_32 (Q32_0 (R2)) / 8

the compiler now indeed generates

   mov     eax, edi  # _8, v
   mov     edx, 3435973837   # tmp107,
   imul    rax, rdx        # _2, tmp107
   shr     rax, 35   # _6,
   ret

This is a very nice result. Thanks.


More information about the Gcc-bugs mailing list