public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wouter dot vermaelen at pi dot be" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/17640] New: empty loop not removed after optimization
Date: Thu, 23 Sep 2004 21:13:00 -0000 [thread overview]
Message-ID: <20040923211344.17640.wouter.vermaelen@pi.be> (raw)
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
next reply other threads:[~2004-09-23 21:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-23 21:13 wouter dot vermaelen at pi dot be [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040923211344.17640.wouter.vermaelen@pi.be \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).