From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5F0873858C5E; Tue, 30 May 2023 18:43:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F0873858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685472237; bh=E85yBqSEyIwBk7Vc05pbtrjwYWuOPXmo/NB7DzBw20M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=n/Q/VCx5I70thmp0ndkOSDLAl8eyEps6rDMZ6samqn2kjBOX2eaAgpjL14bBHkpf2 Svo/wxVNrg56zWX5lx/sLPfOuL6SQXWyZWviv9bPzyRh4GnjoLe5RRL/tKSetNXuVw 1RmKjjBEbQKtQK7biYm0T45372af0wJG6pwb7jgE= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/58483] missing optimization opportunity for const std::vector compared to std::array Date: Tue, 30 May 2023 18:43:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D58483 --- Comment #17 from Andrew Pinski --- Here is related reduced testcase: ``` int f(void) { int tt =3D 100; int t[3] =3D {10,20,30}; int *t1 =3D new int[3]; __builtin_memcpy(t1, t, sizeof(t)); for(int *i =3D t1; i !=3D &t1[3]; i++) tt +=3D *i; delete[] t1; return tt; } ``` Note in the above testcase we can remove the memcpy but not the operator new/delete. This is unlike the original testcase where memcpy is not remov= ed either.=