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

--- Comment #3 from Andi Kleen <andi-gcc at firstfloor dot org> ---
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;
}

int funsigned(unsigned a)
{
        return 0x1fffffffL / a == 0;
}

>So this should be optimized to a > 100 instead.

Yes this would make sense too.

Reply via email to