[llvm-bugs] [Bug 48633] New: False positive "uninitialized field at the end of the constructor call [optin.cplusplus.UninitializedObject]"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 30 03:44:09 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48633

            Bug ID: 48633
           Summary: False positive "uninitialized field at the end of the
                    constructor call
                    [optin.cplusplus.UninitializedObject]"
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: mtekieli at gmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

Minimal example:

////
struct data
{
    //data(int i) : m_data{i} {}
    int m_data;
};

struct wrapper : public data
{
    wrapper(int a, int b) : data{a}, m_wrapper{b} {}

    int m_wrapper;
};

int main()
{
    wrapper wrapped_data{1, 2};
}
////

m_data is reported uninitialized when struct data has no explicitly defined
constructor. See https://godbolt.org/z/esWonj
Reproducible on llvm 9,10 and 11.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201230/1bedebab/attachment.html>


More information about the llvm-bugs mailing list