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:
bad_function (int n)
if (n > 0)
c = 0;
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.
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 email@example.com.
*** This bug has been marked as a duplicate of bug 18501 ***