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++/37854] No error when creating a variable from itself
Date: Thu, 16 Oct 2008 19:09:00 -0000	[thread overview]
Message-ID: <20081016190808.17232.qmail@sourceware.org> (raw)
In-Reply-To: <bug-37854-16841@http.gcc.gnu.org/bugzilla/>



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-10-16 19:08 -------
In this case since x and y are empty structs there are no real uses of them.
If I change the code to:
struct X {int i;};

int main()
{
  int i = i;
  X x = x;
  X y(y);
  return i+x.i+y.i;
}
--- CUT ---
And turn on optimization, I get the following warnings:
t.c: In function 'int main()':
t.c:5: warning: 'i' is used uninitialized in this function
t.c:8: warning: 'x.X::i' is used uninitialized in this function
t.c:8: warning: 'y.X::i' is used uninitialized in this function


Note all of the above warnings should only happen with -Winit-self (which works
correctly with the C front-end and is PR 34772 ).


-- 


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


  parent reply	other threads:[~2008-10-16 19:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-16 16:03 [Bug c++/37854] New: " julien dot sagnard at gmail dot com
2008-10-16 16:18 ` [Bug c++/37854] " paolo dot carlini at oracle dot com
2008-10-16 16:20 ` paolo dot carlini at oracle dot com
2008-10-16 16:23 ` paolo dot carlini at oracle dot com
2008-10-16 19:09 ` pinskia at gcc dot gnu dot org [this message]
2008-10-21 20:59 ` 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=20081016190808.17232.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).