[LLVMbugs] [Bug 12672] New: False positive for conditional operator
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Apr 25 21:31:24 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12672
Bug #: 12672
Summary: False positive for conditional operator
Product: clang
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: roland at utk.edu
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
With
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv) {
char *s;
int a = atoi(argv[1]);
if (a) {
s = strdup("test");
}
return a ? s[0] : 0;
}
I get:
test.c:9:3: warning: Undefined or garbage value returned to caller
But because because the if statement and the tertiary operator have the same
condition this shouldn't give a warning.
--
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