This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 May 2008 09:51:07 -0000
- Subject: [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
- References: <bug-36168-2736@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from pinskia at gcc dot gnu dot org 2008-05-07 09:51 -------
Also you may as well manually unswitch the loops as they don't do anything
except some multiplication if that bool is true. That is better to write the
code as:
if (a_eq_e)
return;
e=p[m].e;
q=COLOUR8(e.r/(a.r+grayabsorb),e.g/(a.g+grayabsorb),e.b/(a.b+grayabsorb));
float64 radsq = rfacr*rfacr;
float64 prefac1 = -0.5/(r*r*sigma0*sigma0);
float64 prefac2 = -0.5*bfak/p[m].ro;
{
for (int x=minx; x<maxx; ++x)
{
float64 xsq=(x-posx)*(x-posx);
for (int y=miny; y<maxy; ++y)
{
float64 dsq = (y-posy)*(y-posy) + xsq;
if (dsq<radsq)
{
lpic[x][y].r = q.r;
lpic[x][y].g = q.g;
}
}
}
}
As you now have better code as the code is faster as you don't have to go
through those loops at all or even calculate the inner float64s.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36168