public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/34772] self-initialisation does not silence uninitialised warnings (-Winit-self ignored)
Date: Mon, 14 Jan 2008 07:43:00 -0000	[thread overview]
Message-ID: <20080114012742.17743.qmail@sourceware.org> (raw)
In-Reply-To: <bug-34772-2228@http.gcc.gnu.org/bugzilla/>



------- Comment #4 from manu at gcc dot gnu dot org  2008-01-14 01:27 -------
(In reply to comment #3)
> I think it would be better to fix the documentation to reflect the current
> behaviour for C++/ObjC++, and mark this bug as an enhancement request.

It is a bit misleading providing -Winit-self when it has no effect and when it
cannot be disabled. But your argument about breaking existing code is solid.
So, of course, I will only update the documentation:

Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 130605)
+++ gcc/doc/invoke.texi (working copy)
@@ -2827,14 +2827,15 @@
 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
 can be disabled with the @option{-Wno-nonnull} option.

-@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
+@item -Winit-self @r{(C and Objective-C only)}
 @opindex Winit-self
 Warn about uninitialized variables which are initialized with themselves.
 Note this option can only be used with the @option{-Wuninitialized} option,
 which in turn only works with @option{-O1} and above.

-For example, GCC will warn about @code{i} being uninitialized in the
-following snippet only when @option{-Winit-self} has been specified:
+For C and Objective-C, GCC will silence the warning about @code{i}
+being uninitialized in the following snippet unless
+@option{-Winit-self} has been specified:
 @smallexample
 @group
 int f()
@@ -3094,11 +3095,12 @@
 These warnings are possible only in optimizing compilation,
 because they require data flow information that is computed only
 when optimizing.  If you do not specify @option{-O}, you will not get
-these warnings. Instead, GCC will issue a warning about
@option{-Wuninitialized}
-requiring @option{-O}.
+these warnings. Instead, GCC will issue a warning about
+@option{-Wuninitialized} requiring @option{-O}.

-If you want to warn about code which uses the uninitialized value of the
-variable in its own initializer, use the @option{-Winit-self} option.
+For C and Objective-C, using the uninitialized value of the variable in its
+own initializer (e.g. @samp{int i = i;}) silences the warning. If you
+want to warn about such code use the @option{-Winit-self} option.

 These warnings occur for individual uninitialized or clobbered
 elements of structure, union or array variables as well as for


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
            Summary|-Winit-self ignored when    |self-initialisation does not
                   |compiling C++ (and ObjC++)  |silence uninitialised
                   |                            |warnings (-Winit-self
                   |                            |ignored)


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


  parent reply	other threads:[~2008-01-14  1:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-13 18:24 [Bug c++/34772] New: -Winit-self ignored when compiling C++ (and ObjC++) olly at survex dot com
2008-01-13 18:50 ` [Bug c++/34772] " olly at survex dot com
2008-01-14  1:12 ` manu at gcc dot gnu dot org
2008-01-14  1:36 ` olly at survex dot com
2008-01-14  7:43 ` manu at gcc dot gnu dot org [this message]
2008-01-14  8:32 ` [Bug c++/34772] self-initialisation does not silence uninitialised warnings (-Winit-self ignored) manu at gcc dot gnu dot org
2008-01-14  8:59 ` pinskia at gcc dot gnu dot org
2008-01-14  9:29 ` [Bug c++/34772] [3.4/4.0/4.1/4.2/4.3 Regression] " manu at gcc dot gnu dot org
2008-01-14 10:59 ` [Bug c++/34772] [4.1/4.2/4.3 " rguenth at gcc dot gnu dot org
2008-01-20  7:02 ` pinskia at gcc dot gnu dot org
2008-07-04 22:28 ` [Bug c++/34772] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-10-16 16:18 ` paolo dot carlini at oracle dot com
2009-03-31 20:17 ` [Bug c++/34772] [4.3/4.4/4.5 " jsm28 at gcc dot gnu dot org
2009-08-04 12:48 ` rguenth at gcc dot gnu dot org
2009-12-30 11:29 ` manu at gcc dot gnu dot org
2010-05-22 18:21 ` [Bug c++/34772] [4.3/4.4/4.5/4.6 " rguenth 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=20080114012742.17743.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).