[LLVMbugs] [Bug 9624] New: False positive with -Wuninitialized with explicit self-initialization

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 4 12:02:19 PDT 2011


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

           Summary: False positive with -Wuninitialized with explicit
                    self-initialization
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chandlerc at gmail.com
                CC: llvmbugs at cs.uiuc.edu


A lot of code uses the construct of direct explicit initialization to mark it
as intentional. The static analysis based -Wuninitialized should avoid warning
on this code.

% cat x.cc
void test() {
  int x = x;
  (void)x;
}

% ./bin/clang -fsyntax-only -Wuninitialized x.cc
x.cc:2:11: warning: variable 'x' is possibly uninitialized when used here
[-Wuninitialized]
  int x = x;
          ^
x.cc:2:3: note: variable 'x' is declared here
  int x = x;
  ^
x.cc:2:12: note: add initialization to silence this warning
  int x = x;
           ^
            = 0

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