[LLVMbugs] [Bug 8869] New: False positive with static analyzer and struct initialization through a temporary.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 28 12:56:27 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=8869

           Summary: False positive with static analyzer and struct
                    initialization through a temporary.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: juli at clockworksquid.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=5933)
 --> (http://llvm.org/bugs/attachment.cgi?id=5933)
Mostly-reduced test case.

With the attachment compiled with --analyze, the static analyzer gives:

%%%
small.cc:25:2: warning: Undefined or garbage value returned to caller
        return (f.foo_);
        ^      ~~~~~~~~
%%%

This happens with the existing initialization of f:

%%%
        Foo f = Foo::get();
%%%

As well as a similar variant:

%%%
        Foo f(Foo::get());
%%%

But not with other cases that do not involve use of a temporary to set the
fields of f, these both work:

%%%
    Foo b = Foo::get();
    Foo f(b);
%%%

%%%
    Foo f;
%%%

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list