https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98130
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #4) > That would mean: > > --- gcc/testsuite/g++.dg/opt/pr98130.C.jj 2020-12-04 12:30:11.510988404 > +0100 > +++ gcc/testsuite/g++.dg/opt/pr98130.C 2020-12-04 12:33:05.663028984 > +0100 > @@ -0,0 +1,25 @@ > +// PR c++/98130 > +// { dg-do run { target c++11 } } > +// { dg-options "-O2" } > + > +#include <new> > + > +typedef int *T; > + > +static unsigned char storage[sizeof (T)] alignas (T); > +static T *p = (T *) storage; > + > +static inline __attribute__((__always_inline__)) void > +foo (T value) > +{ > + new (p) T(value); > +} > + > +int > +main () > +{ > + int a; > + foo (&a); > + if (!*p) > + __builtin_abort (); > +} > --- gcc/gimple.c.jj 2020-11-26 01:14:47.528081989 +0100 > +++ gcc/gimple.c 2020-12-04 12:34:44.865911907 +0100 > @@ -1514,11 +1514,12 @@ gimple_call_fnspec (const gcall *stmt) > such operator, then we can treat it as free. */ > if (fndecl > && DECL_IS_OPERATOR_DELETE_P (fndecl) > + && DECL_IS_REPLACEABLE_OPERATOR (fndecl) > && gimple_call_from_new_or_delete (stmt)) > return ".co "; > /* Similarly operator new can be treated as malloc. */ > if (fndecl > - && DECL_IS_OPERATOR_NEW_P (fndecl) > + && DECL_IS_REPLACEABLE_OPERATOR_NEW_P (fndecl) > && gimple_call_from_new_or_delete (stmt)) > return "mC"; > return ""; > > but the testcase is miscompiled even with that change, and we don't really > return ".co " nor "mC" on the testcase. The fix works for me? Note I think we don't need the extra check on the delete case.