From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 19027395201B; Mon, 19 Jul 2021 14:36:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 19027395201B From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101480] [11/12 Regression] Miscompiled code involving operator new Date: Mon, 19 Jul 2021 14:36:54 +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.1.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: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.2 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: Mon, 19 Jul 2021 14:36:55 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101480 --- Comment #14 from Richard Biener --- diff --git a/gcc/gimple.c b/gcc/gimple.c index 863bc0d17f1..e085d9de49a 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -1516,12 +1516,12 @@ gimple_call_fnspec (const gcall *stmt) && DECL_IS_OPERATOR_DELETE_P (fndecl) && DECL_IS_REPLACEABLE_OPERATOR (fndecl) && gimple_call_from_new_or_delete (stmt)) - return ".co "; + return ". o "; /* Similarly operator new can be treated as malloc. */ if (fndecl && DECL_IS_REPLACEABLE_OPERATOR_NEW_P (fndecl) && gimple_call_from_new_or_delete (stmt)) - return "mC"; + return "m "; return ""; } regresses FAIL: g++.dg/warn/Warray-bounds-16.C -std=3Dgnu++14 scan-tree-dump-not optimized "goto" FAIL: g++.dg/warn/Warray-bounds-16.C -std=3Dgnu++14 (test for excess error= s) where we now diagnose /home/rguenther/src/trunk/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:22:7: warning: array subscript 0 is outside array bounds of 'void [0]' [-Warray-bounds] /home/rguenther/src/trunk/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:22:7: warning: 'void* __builtin_memset(void*, int, long unsigned int)' offset [0,= 3] is out of the bounds [0, 0] [-Warray-bounds] the testcase does m =3D i; p =3D (int*) new unsigned char [sizeof (int) * m]; for (int i =3D 0; i < m; i++) new (p + i) int (); and we likely have to assume that 'new' changes 'm'.=