From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8878D3858D1E; Wed, 17 May 2023 15:43:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8878D3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684338220; bh=sXXtIp+XyaFGMuD1YvUQUNCXLfTjPC50Ff0q7ISEBIM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tVyV1/6iP0a7uXZvZ+yU378h2Qm+DDcbmBLO670gVXCN7bNc91veGjCoDl0BC7jF/ Dsu+7FEYFOc317kBL/sWeT+WNUhWFaIpnTOtf1wBo0+l+0AihqMAYa7RDH8JpTt0Bl huhxCl6Ng1/ldIbAWFFCOjTbZdkUdDjOrwPl67qU= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/90663] [10/11/12/13/14 Regression] strcmp (&a[i], a + i) not folded for arrays and constant index Date: Wed, 17 May 2023 15:43:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 9.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: 10.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to 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=3D90663 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEW Assignee|pinskia at gcc dot gnu.org |unassigned at gcc d= ot gnu.org --- Comment #11 from Andrew Pinski --- (In reply to Andrew Pinski from comment #10) > Created attachment 55097 [details] > Patch which I am testing Hmm, one failure +FAIL: c-c++-common/Wrestrict.c -Wc++-compat memcpy (test for warnings, l= ine 120) GCC's code says: /* Avoid diagnosing exact overlap in calls to __builtin_memcpy. It's safe and may even be emitted by GCC itself (see bug 32667). */ Reduced testcase for the missing warning: ``` /* PR 35503 - Warn about restricted pointers { dg-do compile } { dg-options "-O2 -Wrestrict -ftrack-macro-expansion=3D0" } */ void sink (void*, ...); /* Exercise memcpy with constant or known arguments. */ void test_memcpy_cst (void *d, const void *s) { struct { char a[7]; char b[7]; char c[7]; } x; sink (&x); d =3D x.a + 7; s =3D x.b; __builtin_memcpy (d, s, 3); /* { dg-warning "\\\[-Wrestrict" "memcpy" } */ sink (&x); } ``` I am no longer working on this because I am not 100% sure if we want to sti= ll warn here or not ...=