[Bug tree-optimization/125738] `a/b==0` can be simplified into a < b when a and b are non-negative

kaelfandrew at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jun 19 17:19:57 GMT 2026


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

Kael Franco <kaelfandrew at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kaelfandrew at gmail dot com

--- Comment #3 from Kael Franco <kaelfandrew at gmail dot com> ---
Created attachment 64804
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64804&action=edit
Potential patch

(In reply to Drea Pinski from comment #0)
> int
> f (unsigned short a, unsigned short b) {
>   int aa = a;
>   int bb = b;
>   int c = aa / bb;
>   return c == 0;
> }

How do I test for this?


More information about the Gcc-bugs mailing list