https://gcc.gnu.org/g:c3f8414d18c4b6644fcd414cd8d89427fbe1f3d8
commit r16-4311-gc3f8414d18c4b6644fcd414cd8d89427fbe1f3d8 Author: Sam James <[email protected]> Date: Tue Oct 7 01:51:55 2025 +0100 doc: mention -Wmaybe-uninitialized vs CCP CCP interacts poorly with -Wmaybe-uninitialized in some cases by assuming a value which stops us warning about it (false negatives). Inform users about this infamous interaction. gcc/ChangeLog: PR tree-optimization/18501 * doc/invoke.texi (-Wmaybe-uninitialized): Mention interaction with CCP. Diff: --- gcc/doc/invoke.texi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index f93fe43733dc..8802d416b30c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -8375,7 +8375,10 @@ known to read the object.) Annotating the function with attribute the object and avoids the warning (@pxref{Common Function Attributes}). These warnings are only possible in optimizing compilation, because otherwise -GCC does not keep track of the state of variables. +GCC does not keep track of the state of variables. On the other hand, +@option{-Wmaybe-uninitialized} is known not to warn in many situations +(false negatives) due to optimizations taking advantage of undefinedness +of uninitialized uses like constant propagation. These warnings are made optional because GCC may not be able to determine when the code is correct in spite of appearing to have an error. Here is one
