public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/39683]  New: -fstrict-overflow misses multiply in comparison
@ 2009-04-07 20:07 tkoenig at gcc dot gnu dot org
  2009-04-07 20:14 ` [Bug tree-optimization/39683] " pinskia at gcc dot gnu dot org
  2009-04-08  9:11 ` rguenth at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2009-04-07 20:07 UTC (permalink / raw)
  To: gcc-bugs

The shift isn't necessary.  This could have
been re-coded as

    return (a-b)<2;

with -fstrict-overflow.

$ cat ga.c
int foo(int a, int b)
{
    return (a-b)*4 < 8;
}
$ gcc -S -O2 -fstrict-overflow ga.c
$ cat ga.s
        .file   "ga.c"
        .text
        .p2align 4,,15
.globl foo
        .type   foo, @function
foo:
        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %eax
        subl    12(%ebp), %eax
        popl    %ebp
        sall    $2, %eax
        cmpl    $7, %eax
        setle   %al
        movzbl  %al, %eax
        ret
        .size   foo, .-foo
        .ident  "GCC: (GNU) 4.4.0 20090221 (experimental)"
        .section        .note.GNU-stack,"",@progbits


-- 
           Summary: -fstrict-overflow misses multiply in comparison
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39683


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

* [Bug tree-optimization/39683] -fstrict-overflow misses multiply in comparison
  2009-04-07 20:07 [Bug tree-optimization/39683] New: -fstrict-overflow misses multiply in comparison tkoenig at gcc dot gnu dot org
@ 2009-04-07 20:14 ` pinskia at gcc dot gnu dot org
  2009-04-08  9:11 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-07 20:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-04-07 20:14 -------
Related to PR 31096.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39683


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

* [Bug tree-optimization/39683] -fstrict-overflow misses multiply in comparison
  2009-04-07 20:07 [Bug tree-optimization/39683] New: -fstrict-overflow misses multiply in comparison tkoenig at gcc dot gnu dot org
  2009-04-07 20:14 ` [Bug tree-optimization/39683] " pinskia at gcc dot gnu dot org
@ 2009-04-08  9:11 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-08  9:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-04-08 09:11 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |31096
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-08 09:11:25
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39683


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

end of thread, other threads:[~2009-04-08  9:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-07 20:07 [Bug tree-optimization/39683] New: -fstrict-overflow misses multiply in comparison tkoenig at gcc dot gnu dot org
2009-04-07 20:14 ` [Bug tree-optimization/39683] " pinskia at gcc dot gnu dot org
2009-04-08  9:11 ` rguenth at gcc dot gnu dot 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).