public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17640] New: empty loop not removed after optimization
@ 2004-09-23 21:13 wouter dot vermaelen at pi dot be
  2004-09-23 23:01 ` [Bug c/17640] " pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: wouter dot vermaelen at pi dot be @ 2004-09-23 21:13 UTC (permalink / raw)
  To: gcc-bugs

gcc can optimize this program quite well. However the remaining empty loop is a 
bit silly.  
  
 
int f() { return 1; }  
  
int main() {  
  int a = 0;  
  for (int i = 0; i < 100; ++i) {  
    a += f();  
  }  
  return a;  
}  
 
 
> gcc loop.c -O3 -S 
  
main:   pushl   %ebp  
        movl    %esp, %ebp  
        subl    $8, %esp  
        andl    $-16, %esp  
        subl    $16, %esp  
        movl    $99, %eax  
.L7:    decl    %eax  
        jns     .L7  
        movl    $100, %eax  
        leave  
        ret

-- 
           Summary: empty loop not removed after optimization
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wouter dot vermaelen at pi dot be
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2005-07-12  0:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
2004-09-23 23:01 ` [Bug c/17640] " pinskia at gcc dot gnu dot org
2004-09-23 23:05 ` [Bug tree-optimization/17640] " pinskia at gcc dot gnu dot org
2004-12-24  2:26 ` pinskia at gcc dot gnu dot org
2005-01-28 14:26 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-01-28 15:18 ` steven at gcc dot gnu dot org
2005-05-11 12:58 ` giovannibajo at libero dot it
2005-05-11 13:00 ` pinskia at gcc dot gnu dot org
2005-05-11 13:02 ` rguenth at gcc dot gnu dot org
2005-05-11 13:14 ` stevenb at suse dot de
2005-05-11 13:16 ` steven at gcc dot gnu dot org
2005-06-30 21:48 ` steven at gcc dot gnu dot org
2005-07-12  0:01 ` pinskia 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).