public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/36168] Incorrect (and strange) warnings with -Wuninitialized
Date: Wed, 07 May 2008 09:51:00 -0000	[thread overview]
Message-ID: <20080507095107.31494.qmail@sourceware.org> (raw)
In-Reply-To: <bug-36168-2736@http.gcc.gnu.org/bugzilla/>



------- 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


  parent reply	other threads:[~2008-05-07  9:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-07  9:34 [Bug c++/36168] New: " martin at mpa-garching dot mpg dot de
2008-05-07  9:35 ` [Bug c++/36168] " martin at mpa-garching dot mpg dot de
2008-05-07  9:44 ` pinskia at gcc dot gnu dot org
2008-05-07  9:51 ` pinskia at gcc dot gnu dot org [this message]
2008-05-07  9:52 ` martin at mpa-garching dot mpg dot de
2008-05-07  9:54 ` pinskia at gcc dot gnu dot org
2008-05-07  9:57 ` martin at mpa-garching dot mpg dot de
2008-05-07 10:13 ` manu at gcc dot gnu dot org
2008-08-29  3:53 ` manu at gcc dot gnu dot org
2008-12-28  5:13 ` pinskia at gcc dot gnu dot org
2009-02-09 16:13 ` [Bug c++/36168] bogus uninitialized warning (huge testcase) manu at gcc dot gnu dot org
2009-02-09 16:15 ` manu 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=20080507095107.31494.qmail@sourceware.org \
    --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).