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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to