[Bug tree-optimization/64130] vrp: handle non zero constant divided by range cannot be zero.

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 1 09:30:00 GMT 2014


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-01
     Ever confirmed|0                           |1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andi Kleen from comment #3)
> You're right. I actually meant
> 
> x >= maxval(typeof(a)), x / a   cannot be 0.
> 
> Corrected test case (assuming 64bit target):
> 
> #include <limits.h>
> 
> int fsigned(int a)
> {
>         return 0x1fffffffL / a == 0;
> }

0x1fffffffL / 0x20000000 == 0

Maybe you meant 0x1fffffffffffffffL / a == 0?

> int funsigned(unsigned a)
> {
>         return 0x1fffffffL / a == 0;
> }
> 
> >So this should be optimized to a > 100 instead.
> 
> Yes this would make sense too.

Yes.



More information about the Gcc-bugs mailing list