[LLVMbugs] [Bug 11839] New: Static analyzer gives no warnings in #included *.c files

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 23 18:04:31 PST 2012


             Bug #: 11839
           Summary: Static analyzer gives no warnings in #included *.c
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: listrp at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat foo.c
int foo( void ) { 
 int x;
 if ( x ) return 1; /* uninitialized */
 return 0;

$ cat main.c
#include "foo.c" /* ignored by static analyzer? */
int main( void ) { 
 return 0;

$ clang main.c --analyze
$ clang --version
clang version 3.1 (trunk 148340)

Analysis of main.c is defective. Explicit analysis of foo.c does give a

$ clang foo.c --analyze
foo.c:3:10: warning: Branch condition evaluates to a garbage value
 if ( x ) return 1; /* uninitialized */
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.

More information about the llvm-bugs mailing list