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: [email protected]
ReportedBy: [email protected]
CC: [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs