public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56523] New: -Wunitialized is described to be enabled -Wall
@ 2013-03-04 16:03 corentinjabot at gmail dot com
  2013-03-04 16:16 ` [Bug c/56523] -Wunitialized is described to be enabled by -Wall paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: corentinjabot at gmail dot com @ 2013-03-04 16:03 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56523
           Summary: -Wunitialized is described to be enabled -Wall
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: corentinjabot@gmail.com


The online docs ( http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html ) and
the gcc 4.7 man page state incorrectly that -Wall enable -Wunitialized.

The docs also state -Wunitialized is enable by -Wextra, and that is the
observed and correct behaviour.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/56523] -Wunitialized is described to be enabled by -Wall
  2013-03-04 16:03 [Bug c/56523] New: -Wunitialized is described to be enabled -Wall corentinjabot at gmail dot com
@ 2013-03-04 16:16 ` paolo.carlini at oracle dot com
  2013-03-04 17:33 ` corentinjabot at gmail dot com
  2013-03-04 17:44 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-03-04 16:16 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-03-04 16:16:16 UTC ---
On which basis do you think it doesn't? In practice, for a stupid example like
the below, with -Wall:

int main()
{
  int a;
  return a;
}

I get:

test.c: In function ‘main’:
test.c:4:3: warning: ‘a’ is used uninitialized in this function
[-Wuninitialized]


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/56523] -Wunitialized is described to be enabled by -Wall
  2013-03-04 16:03 [Bug c/56523] New: -Wunitialized is described to be enabled -Wall corentinjabot at gmail dot com
  2013-03-04 16:16 ` [Bug c/56523] -Wunitialized is described to be enabled by -Wall paolo.carlini at oracle dot com
@ 2013-03-04 17:33 ` corentinjabot at gmail dot com
  2013-03-04 17:44 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: corentinjabot at gmail dot com @ 2013-03-04 17:33 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from corentinjabot at gmail dot com 2013-03-04 17:33:26 UTC ---
Actually after a few more test it works correctly but the statement "This
enables some extra warning flags that are not enabled by -Wall." is confusing
since the to set of options overlap. 

I also tested with the following c++ snippet:

#include <iostream>
class A {
public:
    A() {}
    bool foo;
    void bar() {
        if(foo)
            std::cout << "Foo\n";
    }
};

int main () {
    A a;
    a.bar();
    return 0;
}

The uninitialized variable is detected only with -O1. It is vaguely documented
but that behavior seems quite odd and unexpected when you are not aware of it.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/56523] -Wunitialized is described to be enabled by -Wall
  2013-03-04 16:03 [Bug c/56523] New: -Wunitialized is described to be enabled -Wall corentinjabot at gmail dot com
  2013-03-04 16:16 ` [Bug c/56523] -Wunitialized is described to be enabled by -Wall paolo.carlini at oracle dot com
  2013-03-04 17:33 ` corentinjabot at gmail dot com
@ 2013-03-04 17:44 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-03-04 17:44 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-03-04 17:43:18 UTC ---
That some warnings are only emitted when optimizing is well known, and
discussed in many places.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-04 17:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-04 16:03 [Bug c/56523] New: -Wunitialized is described to be enabled -Wall corentinjabot at gmail dot com
2013-03-04 16:16 ` [Bug c/56523] -Wunitialized is described to be enabled by -Wall paolo.carlini at oracle dot com
2013-03-04 17:33 ` corentinjabot at gmail dot com
2013-03-04 17:44 ` paolo.carlini at oracle dot com

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