This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/80852] Optimisation fails to recognise sum computed by loop
- From: "drraph at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 22 May 2017 08:03:17 +0000
- Subject: [Bug c/80852] Optimisation fails to recognise sum computed by loop
- Auto-submitted: auto-generated
- References: <bug-80852-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80852
--- Comment #2 from Raphael C <drraph at gmail dot com> ---
You are quite right. This code shows the same issue:
int foo(int num) {
int a = 0;
for (int x = 0; x < num; x+=2) {
a += x;
}
return a;
}