[LLVMbugs] [Bug 9625] New: False positive with -Wuninitialized in trivially dead code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 4 12:04:32 PDT 2011


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

           Summary: False positive with -Wuninitialized in trivially dead
                    code
           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


I thought we were able to prune trivially dead code:

% cat x.cc
void test() {
  if (false) {
    int x;
    (void)static_cast<float>(x);
  }
}

% ./bin/clang -fsyntax-only -Wuninitialized x.cc
x.cc:4:30: warning: variable 'x' is possibly uninitialized when used here
[-Wuninitialized]
    (void)static_cast<float>(x);
                             ^
x.cc:3:5: note: variable 'x' is declared here
    int x;
    ^
x.cc:3:10: note: add initialization to silence this warning
    int x;
         ^
          = 0
1 warning generated.

(the original code is doing casts to check if pointers are convertible, but
same difference)

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