https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83755

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-01-09
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
In the original example the address really is a null-terminated string, but it
isn't always:

#include <memory>
int main()
{
  char a[] = {'a', 'b', 'c', 'd'};
  std::unique_ptr<char> p(&a[0]);
  p.release();
}

This just prints garbage on the stack until it reaches a nul:

$1 = std::unique_ptr<char> containing 0x7fffffffd38c "abcd \t@"

Reply via email to