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: unassig...@gcc.gnu.org
        ReportedBy: egg...@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.

Reply via email to