http://llvm.org/bugs/show_bug.cgi?id=9282
Summary: [C++] False positive about garbage value with structs.
Product: clang
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Created an attachment (id=6202)
--> (http://llvm.org/bugs/attachment.cgi?id=6202)
Reduced test case
When a struct is initialized using a function, the analyzer does not detect
that it has been initialized and warns about garbage value.
------------- struct.cpp
typedef struct CGSize { float width; float height; } CGSize;
extern CGSize CGSizeMake(float w, float h);
float test() {
CGSize s = CGSizeMake(0, 0);
return s.width;
}
-------------
% clang++ --analyze struct.cpp
struct.cpp:8:2: warning: Undefined or garbage value returned to caller
return s.width;
^ ~~~~~~~
1 warning generated.
--
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