This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36814] New: G++ won't warn about an uninitialized value
- From: "jellegeerts at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jul 2008 20:04:11 -0000
- Subject: [Bug c++/36814] New: G++ won't warn about an uninitialized value
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hello,
I've compiled the code below using `g++ -Wuninitialized -O test.cc -o test':
<<<<<<<<<<<<<<<
bool cMyClass::Init()
{
bool retval;
if (some_function())
{
// If the `goto' is executed, 'return retval;' will use the
// uninitialized value of 'retval'.
goto error;
}
retval = true;
error:
return retval;
}
>>>>>>>>>>>>>>>
The problem is explained in the code comments above.
I think that GCC is supposed to warn about this, is that correct?
Thanks, Jelle
--
Summary: G++ won't warn about an uninitialized value
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jellegeerts at gmail dot com
GCC build triplet: i386-undermydesk-freebsd
GCC host triplet: i386-undermydesk-freebsd
GCC target triplet: i386-undermydesk-freebsd
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36814