[LLVMbugs] [Bug 8488] New: Clang should warn on use of a local variable in its own initializer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 27 14:35:59 PDT 2010


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

           Summary: Clang should warn on use of a local variable in its
                    own initializer
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthewbg at google.com
                CC: llvmbugs at cs.uiuc.edu


-Wuninitialized should complain about this:
void f() {
  int i = i;
}

A more realistic example of how this could happen:
void f(int* encoded_result) {
 // Note the typo below, it should be
 // bool encode_result = (encoded_result != NULL);
 bool encode_result = (encode_result != NULL);
 if (encode_result) *encoded_result = 42;
}

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