Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Feb 2017 13:59:33 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 217200] std::make_shared does not perform zero initialization
Message-ID:  <bug-217200-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help

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@FreeBSD.org
          Reporter: dim@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.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-217200-8>