[llvm-bugs] [Bug 49627] New: Static analyzer false positive UninitializedObject with aggregate type as base

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 18 06:48:03 PDT 2021


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

            Bug ID: 49627
           Summary: Static analyzer false positive UninitializedObject
                    with aggregate type as base
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: dmjpp at hotmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

The following code falsely triggers warning for uninitialized object.

#include <cassert>

struct A {
    int x;

    // A(int a): x(a) {} // If I uncomment this, A is no longer aggregate,
                         // the warning is gone.
};

struct B:A {
    int y;
    B(int a, int b): A{a}, y(b) {} // fails to see the aggregate init A{a}
};

int main()
{
    B b(1, 3);
    assert(b.x == 1);
    assert(b.y == 3);
}

-- 
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/20210318/1db38d3d/attachment.html>


More information about the llvm-bugs mailing list