From 4bd9c84c523256b64f8e8a24b1b1284dfc301ef2 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 21 Nov 2017 18:38:18 +0000 Subject: [PATCH] Improve -Wmaybe-uninitialized documentation * doc/invoke.texi (-Wmaybe-uninitialized): Rephrase for clarity. From-SVN: r255022 --- gcc/ChangeLog | 4 ++++ gcc/doc/invoke.texi | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a34c125d429..36c55ebe709 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2017-11-21 Jonathan Wakely + + * doc/invoke.texi (-Wmaybe-uninitialized): Rephrase for clarity. + 2017-11-21 Marc Glisse * doc/generic.texi: Document POINTER_DIFF_EXPR, update diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e18fa545fd2..47323e5b0da 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -4974,14 +4974,18 @@ void store (int *i) @item -Wmaybe-uninitialized @opindex Wmaybe-uninitialized @opindex Wno-maybe-uninitialized -For an automatic variable, if there exists a path from the function -entry to a use of the variable that is initialized, but there exist +For an automatic (i.e.@ local) variable, if there exists a path from the +function entry to a use of the variable that is initialized, but there exist some other paths for which the variable is not initialized, the compiler emits a warning if it cannot prove the uninitialized paths are not -executed at run time. These warnings are made optional because GCC is -not smart enough to see all the reasons why the code might be correct -in spite of appearing to have an error. Here is one example of how -this can happen: +executed at run time. + +These warnings are only possible in optimizing compilation, because otherwise +GCC does not keep track of the state of variables. + +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 +example of how this can happen: @smallexample @group @@ -5008,9 +5012,7 @@ similar code. @cindex @code{longjmp} warnings This option also warns when a non-volatile automatic variable might be -changed by a call to @code{longjmp}. These warnings as well are possible -only in optimizing compilation. - +changed by a call to @code{longjmp}. The compiler sees only the calls to @code{setjmp}. It cannot know where @code{longjmp} will be called; in fact, a signal handler could call it at any point in the code. As a result, you may get a warning -- 2.30.2