This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/29798] [4.3 Regression] -O2 gives wrong results
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Nov 2006 11:46:11 -0000
- Subject: [Bug rtl-optimization/29798] [4.3 Regression] -O2 gives wrong results
- References: <bug-29798-11807@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from rguenth at gcc dot gnu dot org 2006-11-11 11:46 -------
Confirmed. Shorter testcase:
#include <stdio.h>
int main()
{
double rho;
double alpha;
int iter_count;
double oldrho;
double work;
work = 2.0e+0;
for (iter_count=1; iter_count<11; ++iter_count)
{
fprintf(stderr, "1: %g\n", oldrho);
rho = 1 + work * work;
fprintf(stderr, "2: %g\n\n", oldrho);
alpha = rho / (5.0e-1 * work * work);
work = work - alpha * work;
oldrho = rho;
}
return 0;
}
It should print the same "oldrho" value at "1:" and "2:" each iteration
(but the first one, because oldrho is not initialized then, so the behavior
is undefined).
Appearantly this undefinedness in the first iteration makes the difference
here.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Component|tree-optimization |rtl-optimization
Ever Confirmed|0 |1
Keywords| |wrong-code
Known to fail| |4.3.0
Known to work| |4.1.2
Last reconfirmed|0000-00-00 00:00:00 |2006-11-11 11:46:11
date| |
Summary|-O2 gives wrong results |[4.3 Regression] -O2 gives
| |wrong results
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29798