[LLVMbugs] [Bug 1858] New: -warn-uninit-values sizeof() handling wrong

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Dec 12 10:47:59 PST 2007


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

           Summary: -warn-uninit-values sizeof() handling wrong
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


I warnings like these:

../../../libclamav/rtf.c:212:52: warning: use of uninitialized variable
        struct rtf_object_data* data = cli_malloc(sizeof(*data));
                                                          ^

This way of mallocing is my favorite, and  I use it in lots of places, hence I
get lots of these warnings.

I think it should be safe to exclude sizeof() from uninit-var checks.

sizeof() is evaluated at compile-time, so if its argument would be
"uninitialized", the compiler wouldn't be able to compute it, hence I'd get a
compile-error, right?


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