Bug 18648 - gcc does not remove empty loops
Summary: gcc does not remove empty loops
Status: RESOLVED DUPLICATE of bug 17640
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 3.4.3
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2004-11-24 14:55 UTC by Pawel Sikora
Modified: 2004-12-24 02:26 UTC (History)
1 user (show)

See Also:
Host: pentium3-pld-linux
Target: pentium3-pld-linux
Build: pentium3-pld-linux
Known to work:
Known to fail:
Last reconfirmed: 2004-11-24 18:26:31


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2004-11-24 14:55:21 UTC
# cat empty-loop.c

long f()
{
    long i, ret = 0;
    for (i = 0; i < 1000000000; i++)
        ret++;
    return ret;
}

# gcc empty-loop.c -O2 -S && cat empty-loop.s

f:
        pushl   %ebp
        movl    $999999999, %eax
        movl    %esp, %ebp
        .p2align 4,,15
.L5:
        decl    %eax
        jns     .L5
        popl    %ebp
        movl    $1000000000, %eax
        ret

source # http://gcc.gnu.org/ml/gcc-help/2004-11/msg00169.html
Comment 1 Andrew Pinski 2004-11-24 14:58:27 UTC
There might already be a bug about removing empty loops somewhere.
Comment 2 Andrew Pinski 2004-11-24 18:26:30 UTC
Confirmed, there was some hope for this on 4.1.0, it is too late for 4.0.0.
Comment 3 Andrew Pinski 2004-12-24 02:26:38 UTC

*** This bug has been marked as a duplicate of 17640 ***