From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8FA193857C61; Fri, 4 Dec 2020 12:25:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8FA193857C61 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98130] [11 regression] placement new fails on webkit-gtk-2.28.4 since r11-4745-g58c9de46541ade79 Date: Fri, 04 Dec 2020 12:25:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 12:25:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98130 --- Comment #7 from Richard Biener --- (In reply to Jakub Jelinek from comment #4) > That would mean: >=20 > --- 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 > + > +typedef int *T; > + > +static unsigned char storage[sizeof (T)] alignas (T); > +static T *p =3D (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 ""; >=20 > 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.=