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++/32132] bogus warning at -O3 ( 'r' may be used uninitialized in this function ).
Date: Mon, 28 May 2007 21:48:00 -0000	[thread overview]
Message-ID: <20070528214805.20390.qmail@sourceware.org> (raw)
In-Reply-To: <bug-32132-7667@http.gcc.gnu.org/bugzilla/>



------- Comment #5 from pinskia at gcc dot gnu dot org  2007-05-28 21:48 -------
The warning is correct you need to check if str had an error after reading the
integer.  This is not a GCC bug.

The IR looks like:
<bb 7>:
  __comp_ctor  (&str, s, 8);
  this.104 = (struct ios_base *) &str.D.25711;
  __s = this.104 + *(int *) (str.D.25711._vptr.basic_istream + -12);
  D.40158 = __s->_M_fmtflags;
  __s->_M_fmtflags = D.40158 & -57 | 16;
  _M_get_num (&str.D.25711, &__lval);

<bb 8>:
  if (((this.104 + *(int *) (str.D.25711._vptr.basic_istream +
-12))->_M_iostate & 5) != 0)
    goto <bb 10>;
  else
    goto <bb 9>;

<bb 9>:
  __lval.107 = __lval;
  r = __lval.107;

<bb 10>:
  __comp_dtor  (&str);
  return r;

Which shows for sure r may be used unitialized.   

Note using libstdc++ does not warn about this because we made >> out of line
only which means you will not see the warning (even though the warning is
correct).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32132


  parent reply	other threads:[~2007-05-28 21:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-28 20:08 [Bug c++/32132] New: " pluto at agmk dot net
2007-05-28 20:09 ` [Bug c++/32132] " pluto at agmk dot net
2007-05-28 20:13 ` pinskia at gcc dot gnu dot org
2007-05-28 20:16 ` pluto at agmk dot net
2007-05-28 20:26 ` pinskia at gcc dot gnu dot org
2007-05-28 21:48 ` pinskia at gcc dot gnu dot org [this message]
2007-05-29  8:51 ` pluto at agmk dot net
2007-05-29 10:18 ` pluto at agmk dot net
2007-05-29 12:31 ` manu at gcc dot gnu dot org
2007-05-29 12:35 ` pluto at agmk dot net
2007-05-29 12:42 ` pluto at agmk dot net
2007-05-29 12:57 ` manu at gcc dot gnu dot org
2007-06-10  3:19 ` 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=20070528214805.20390.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).