This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/60488] missing uninitialized warning (address taken, VOP)
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Feb 2017 04:21:54 +0000
- Subject: [Bug middle-end/60488] missing uninitialized warning (address taken, VOP)
- Auto-submitted: auto-generated
- References: <bug-60488-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60488
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Known to fail| |4.8.3, 4.9.3, 5.3.0, 6.2.0,
| |7.0
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
You're right that the goto isn't essential here. The same problem can be
demonstrated in the simplified test case below. When f(&a) && f(&b) evaluates
to true (and assuming f() initializes what it points to) there "exists a path
from the function entry to a use of the variable that is initialized." But
f(&a) evaluates to false f(&b) is not called then "there exists a path for
which b is not initialized." Since there is no way to prove that the second
path is not taken at runtime then, according to the documentation, GCC should
emit a warning. However, no warning is issued.
int f (int*);
int foo (void)
{
int a, b;
if (f (&a) && f (&b))
return 0;
return a + b;
}