[LLVMbugs] [Bug 6675] New: clang doesn't warn about accessing uninitialized variables

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 22 06:19:15 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=6675

           Summary: clang doesn't warn about accessing uninitialized
                    variables
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: tss at iki.fi
                CC: llvmbugs at cs.uiuc.edu


This is a major blocker for my attempted switch from gcc to clang. I make this
mistake way too often when coding, so I need to have this warning shown to me
at compile time. Example:

int main(void) {
    int foo;
    return foo;
}

clang gives no warning. gcc -Wall says:

test2.c: In function ‘main’:
test2.c:3: warning: ‘foo’ is used uninitialized in this function

I don't know if this is really static analyzer's job. If it is, I'd still want
it to be shown during normal compiling. For example I would be happy with an
extra clang -Wstatic-analyzer option or something that runs the static analyzer
internally.

-- 
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