https://llvm.org/bugs/show_bug.cgi?id=26640
Bug ID: 26640 Summary: Unitialized variable usage not checked in some cases Product: clang Version: 3.8 Hardware: PC OS: FreeBSD Status: NEW Severity: normal Priority: P Component: Driver Assignee: unassignedclangb...@nondot.org Reporter: bdrew...@freebsd.org CC: llvm-bugs@lists.llvm.org Classification: Unclassified cat > test.c << EOF #include <stdlib.h> int main() { char *p; int maybe_set_p = 0, flag = 1; if (maybe_set_p) p = (char*)malloc(1); if (flag && p) ; return 0; } EOF clang38 -Wall -o test test.c No warning is given about the uninitialized use of p in 'if (flag && p)'. Changing the 'if (maybe_set_p)' to 'if (0)' shows the warning: example.c:10:15: warning: variable 'p' is uninitialized when used here [-Wuninitialized] if (flag && p) ^ example.c:4:10: note: initialize the variable 'p' to silence this warning char *p; ^ = NULL 2 warnings generated. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs