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

            Bug ID: 32002
           Summary: std::make_shared does not perform zero initialization
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

On FreeBSD 10.3, the following program displays "123", but "0" is expected:

#include <memory>
#include <iostream>

int main()
{
    std::make_shared<int>(123);
    std::cout << *std::make_shared<int>();
    return 0;
}

The second std::make_shared reuses the piece of memory of the first one. But it
should initialize it to zero, as if "new (ptr) int()" is called, where ptr is
the address of allocated memory.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to