[Bug tree-optimization/108565] -Wuse-after-free false positive triggered by -O2 on a shared_ptr implementation

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 26 23:24:59 GMT 2023


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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The missed optimization is because we don't optimize:

  MEM[(int *)_28] = 2;
  _8 = operator new (4);

  <bb 3> [local count: 1073741825]:
  MEM[(int *)_8] = 20;
  MEM[(int *)_8] ={v} {CLOBBER};
  operator delete (_8, 4);
  _37 = MEM[(int *)_28];

Until after fre5 and then we miss that _37 == 2.


More information about the Gcc-bugs mailing list