https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112335
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
__old_p_6 = MEM[(struct s * &)ps1_2(D)];
MEM[(struct s * &)ps1_2(D)] = 0B;
if (__old_p_6 != 0B)
goto <bb 3>; [53.47%]
else
goto <bb 4>; [46.53%]
<bb 3> [local count: 574129752]:
s::~s (__old_p_6);
operator delete (__old_p_6, 1);
<bb 4> [local count: 1073741824]:
__p_4 = MEM[(struct s * &)ps2_3(D)];
MEM[(struct s * &)ps2_3(D)] = 0B;
__old_p_5 = MEM[(struct s * &)ps1_2(D)];
Well s::~s could touch the reference std::unique_ptr<s> (ps1).
So this could in theory be an invalid optimization.
I am not sure if that is the only issue here though.