[Bug 217200] std::make_shared does not perform zero initialization
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Feb 18 13:59:33 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217200
Bug ID: 217200
Summary: std::make_shared does not perform zero initialization
Product: Base System
Version: 10.3-STABLE
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: misc
Assignee: freebsd-bugs at FreeBSD.org
Reporter: dim at FreeBSD.org
>From https://bugs.llvm.org/show_bug.cgi?id=32002:
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 the assignee for the bug.
More information about the freebsd-bugs
mailing list