[LLVMbugs] [Bug 1859] New: -warn-uninit-values and "output" parameters

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Dec 12 10:53:36 PST 2007


           Summary: -warn-uninit-values and "output" parameters
           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 get warnings when I have pointer parameters that are written to by called
function, and its contents is uninitialized prior to call

../../../libclamav/others.c:460:12: warning: use of uninitialized variable
    memcpy(salt, name_salt, 16);

This is the code:

unsigned char salt[16 + 32];
memcpy(salt, name_salt, 16);
for(i = 16; i < 48; i++)
        salt[i] = cli_rndnum(256);

Hmm, there's nothing in the prototype of a function that tells "this parameter
is only written to", so yes, clang has no way to know this generally.

Maybe it could have "built-in knowledge" of common libc functions.

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