This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/36814] New: G++ won't warn about an uninitialized value


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]