[Bug tree-optimization/64130] New: vrp: handle non zero constant divided by range cannot be zero.
andi-gcc at firstfloor dot org
gcc-bugzilla@gcc.gnu.org
Sun Nov 30 20:40:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64130
Bug ID: 64130
Summary: vrp: handle non zero constant divided by range cannot
be zero.
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: andi-gcc at firstfloor dot org
The following two functions should always be optimized to return 0
because x > 0, x / a cannot be 0. But VRP misses this case for unknown
reasons, even though it has some code for it in ranges_from_anti_range()
int fsigned(int a)
{
return 100 / a == 0;
}
int funsigned(unsigned a)
{
return 100 / a == 0;
}
gcc50 -fno-non-call-exceptions -O2 -S tvrpdiv.c
gcc version 5.0.0 20141111 (experimental) (GCC)
movl $100, %eax
cltd
idivl %edi
testl %eax, %eax
sete %al
movzbl %al, %eax
ret
xorl %edx, %edx
movl $100, %eax
divl %edi
testl %eax, %eax
sete %al
movzbl %al, %eax
More information about the Gcc-bugs
mailing list