From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D3B3E385B532; Thu, 23 Nov 2023 14:41:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D3B3E385B532 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700750515; bh=0shl/RkqPGw8ZLGHzUe4F07H9MzmZSpedkSYSWqMqQA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=llEs69+d8lLkUTX38s7B25V4sdskm9ujhdWL51d0PVpGjmUYwdzeTSJ5F02RT6FDr iyE5L+qHvZYTPBePv294FxxnD45SON9xYd0m8te0O9vYJq4jOo3sGoGglbFNR6w0N6 6zRDw1X4TbTTonxn0lkGjVsHGzS9g8t0+397OtQI= From: "public at timruffing dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/32667] block copy with exact overlap is expanded as memcpy Date: Thu, 23 Nov 2023 14:41:54 +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: 4.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: public at timruffing dot de 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=3D32667 --- Comment #38 from Tim Ruffing --- (In reply to Rich Felker from comment #36) > If you're happy with a branch, you could probably take restrict off the > arguments and do something like: >=20 > if (src=3D=3Ddest) return; > const char *restrict src2 =3D src; > char *restrict dest2 =3D dest; > ... >=20 I'm not saying that such an implementation will be a good idea, but just a remark: You could, in fact, keep restrict for the arguments in this case, because the object pointed to by src and dest is not accessed at all when src=3D=3Ddest. So this is correct code according to the standard. (The exact semantics of restrict are a bit involved...)=