public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63459] New: operator new and returns_nonnull
@ 2014-10-04 19:24 hubicka at gcc dot gnu.org
  2014-10-04 20:27 ` [Bug c++/63459] " glisse at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-10-04 19:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63459
           Summary: operator new and returns_nonnull
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org

compinling:

struct A {
   virtual int foo(){return 1;}
};
struct B {
   virtual int bar(){return 4;}
};
struct C:B,A {
   virtual int foo(){return 2;}
};
static void
test (struct A *a)
{
  if (a->foo() != 2)
   __builtin_abort ();
}
int
m()
{
  struct A *a = new C;
  test (a);
  return 0;
}

Leads to:
int m() ()
{
  struct A * a;
  void * _4;
  struct A * iftmp.0_6;

  <bb 2>:
  _4 = operator new (16);
  C::C (_4);
  if (_4 != 0B)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  iftmp.0_6 = &MEM[(struct C *)_4].D.2251;

  <bb 4>:
  # a_1 = PHI <iftmp.0_6(3), 0B(2)>
  test (a_1);
  return 0;

}

in release_ssa dump.  It would be nice to use the fact that the default
operator new throw exception instead of returning NULL in out of memory case.

Can optimizer make assumption that THIS parameter to a method call is always
not NULL?


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-11-29 19:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-04 19:24 [Bug c++/63459] New: operator new and returns_nonnull hubicka at gcc dot gnu.org
2014-10-04 20:27 ` [Bug c++/63459] " glisse at gcc dot gnu.org
2014-10-04 20:54 ` hubicka at gcc dot gnu.org
2014-10-04 21:12 ` glisse at gcc dot gnu.org
2014-10-06 14:50 ` rguenth at gcc dot gnu.org
2014-10-08 17:59 ` hubicka at ucw dot cz
2014-10-08 18:19 ` hubicka at ucw dot cz
2014-11-29 19:34 ` glisse at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).