https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87671
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- The problem is that GDB sees a stack address for the int* member of the unique_ptr, but it should be a pointer to the 'int' on the heap: Breakpoint 1, A::A (this=0x7fffffffd2b7, ptr=std::unique_ptr<int> = {...}) at up.cc:7 (gdb) p &ptr $6 = (std::unique_ptr<int, std::default_delete<int> > *) 0x7fffffffd290 (gdb) p ptr._M_t._M_t._M_head_impl $7 = (int *) 0x7fffffffd2b8 The Incorrect value for *ptr is just because it dereferences that bad address. If you step into the operator* function you see that the right address is returned from get() (gdb) step std::unique_ptr<int, std::default_delete<int> >::operator* (this=0x7fffffffd2b8) at /home/jwakely/gcc/8/include/c++/8.2.1/bits/unique_ptr.h:329 std::unique_ptr<int, std::default_delete<int> >::get (this=0x7fffffffd2b8) at /home/jwakely/gcc/8/include/c++/8.2.1/bits/unique_ptr.h:343 (gdb) finish Run till exit from #0 std::unique_ptr<int, std::default_delete<int> >::get (this=0x7fffffffd2b8) at /home/jwakely/gcc/8/include/c++/8.2.1/bits/unique_ptr.h:343 std::unique_ptr<int, std::default_delete<int> >::operator* (this=0x7fffffffd2b8) at /home/jwakely/gcc/8/include/c++/8.2.1/bits/unique_ptr.h:330 Value returned is $8 = (int *) 0x614e70 (gdb) p *$8 $9 = 42 I don't know why GDB sees a bad value for the unique_ptr's data member.