public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/64130] New: vrp: handle non zero constant divided by range cannot be zero.
@ 2014-11-30 20:40 andi-gcc at firstfloor dot org
  2014-11-30 20:47 ` [Bug tree-optimization/64130] " glisse at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: andi-gcc at firstfloor dot org @ 2014-11-30 20:40 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-06-29  8:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-30 20:40 [Bug tree-optimization/64130] New: vrp: handle non zero constant divided by range cannot be zero andi-gcc at firstfloor dot org
2014-11-30 20:47 ` [Bug tree-optimization/64130] " glisse at gcc dot gnu.org
2014-11-30 20:49 ` pinskia at gcc dot gnu.org
2014-11-30 20:57 ` andi-gcc at firstfloor dot org
2014-12-01  9:30 ` rguenth at gcc dot gnu.org
2015-06-18 23:38 ` kugan at gcc dot gnu.org
2015-06-19  7:13 ` pinskia at gcc dot gnu.org
2015-06-19  8:05 ` glisse at gcc dot gnu.org
2015-06-19 11:36 ` kugan at gcc dot gnu.org
2015-06-29  0:16 ` kugan at gcc dot gnu.org
2015-06-29  8:39 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).