public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/48643] New: Improving -Wuninitialized documentation (4.6.0 missed a bug that 3.4.3 caught)
@ 2011-04-16 19:14 eggert at gnu dot org
  2012-10-24 23:57 ` [Bug c/48643] " manu at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: eggert at gnu dot org @ 2011-04-16 19:14 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Improving -Wuninitialized documentation (4.6.0 missed
                    a bug that 3.4.3 caught)
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: eggert@gnu.org


I use GCC to catch bugs in Emacs source code involving uninitialized
variables, and found, to my surprise, that GCC 4.6.0 missed a bug that
GCC 3.4.3 caught.  It took me a while to figure out what was wrong
with the code, and I'd like to suggest better documentation to warn
programmers about this.

In the Debugging Options node, under -Wuninitialized,
the GCC 4.6.0 manual says this:

     Because these warnings depend on optimization, the exact
     variables or elements for which there are warnings will depend on
     the precise optimization options and version of GCC used.

Could you please improve the documentation by adding the following text?

     The warnings detect all local variables that might be used
     uninitialized in the code produced by this particular use of GCC,
     but they do not necessarily warn about similar problems that
     might occur in other compilations.  Here is an example:

    int
    bad_function (int n)
    {
      int c;
      if (n > 0)
        c = 0;
      return c;
    }

     If GCC optimizes this function's entire body away to "return 0;",
     GCC may not report the possibly-uninitialized variable, even
     thought the code may cause problems when the same function is
     compiled with lesser optimization or by a different compiler.


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

* [Bug c/48643] Improving -Wuninitialized documentation (4.6.0 missed a bug that 3.4.3 caught)
  2011-04-16 19:14 [Bug c/48643] New: Improving -Wuninitialized documentation (4.6.0 missed a bug that 3.4.3 caught) eggert at gnu dot org
@ 2012-10-24 23:57 ` manu at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: manu at gcc dot gnu.org @ 2012-10-24 23:57 UTC (permalink / raw)
  To: gcc-bugs


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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |manu at gcc dot gnu.org
         Resolution|                            |DUPLICATE

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-10-24 23:57:21 UTC ---
This is also bug 18501.

There are many ways in which optimizations may prevent the warning being
issued. Just look at how many open bugs are listed in PR24639. The current text
seems to say exactly this. But if you think your text is adding something not
in the current documentation, please submit a patch to gcc-patches@gcc.gnu.org.

*** This bug has been marked as a duplicate of bug 18501 ***


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

end of thread, other threads:[~2012-10-24 23:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-16 19:14 [Bug c/48643] New: Improving -Wuninitialized documentation (4.6.0 missed a bug that 3.4.3 caught) eggert at gnu dot org
2012-10-24 23:57 ` [Bug c/48643] " manu at gcc dot gnu.org

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