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

--- Comment #13 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #10)

[...snip...]

> As already noted above, new can't return null here, and there is no
> dereference anyway. And the pointer isn't leaked, but it seems maybe the
> analyzer doesn't know about destructors?

FWIW the analyzer (presumably incorrectly) considers the case where operator
new returns NULL, and then attempts to write 0 to it.

The leak is due to the analyzer (presumably incorrectly) following the EH cfg
edge from BB 2 to BB 5 below.

int main ()
{
  struct S s;
  int D.2800;
  int _5;

  <bb 2> :
  S::S (&s);

  <bb 3> :
  S::~S (&s);
  s ={v} {CLOBBER(eol)};
  _5 = 0;

  <bb 4> :
<L0>:
  return _5;

  <bb 5> :
<L1>:
  s ={v} {CLOBBER(eol)};
  resx 1

}

Reply via email to