[LLVMbugs] [Bug 10962] New: -Wuninitialized should handle C++ member initializers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 19 23:43:30 PDT 2011


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

           Summary: -Wuninitialized should handle C++ member initializers
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: matthewbg at google.com
                CC: llvmbugs at cs.uiuc.edu


Reduced from a real-life bug:

struct Object {
  Object(int *ptr) { *ptr = 5; }
};
struct UsesObjects {
  UsesObjects() : obj(ptr), ptr(new int) {}
  Object obj;
  int *ptr;
};

runUninitializedVariablesAnalysis only operates on VarDecls, which keeps it
from complaining about the CFG for the UsesObjects constructor:

 [ B2 (ENTRY) ]
    Predecessors (0):
    Successors (1): B1

 [ B1 ]
      1: this->ptr
      2: [B1.1]
      3: obj([B1.2]) (Member initializer)
      4: ptr(new int) (Member initializer)
    Predecessors (1): B2
    Successors (1): B0

 [ B0 (EXIT) ]
    Predecessors (1): B1
    Successors (0):

Since member initialization order is trivially known, applying the full power
of the general uninitialized checker might be overkill, but it would be nice to
have a warning here.

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