From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1F99F384CBAC; Tue, 28 Nov 2023 11:03:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F99F384CBAC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701169396; bh=ve2DJkGKKn4IdFfvi6ZFu2QqgyaNlqVFxSFdItfQkuo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lONsTsRJEtqnNOr9X4PVVH0ypsW7KmzOQI7HG4KKOXWJJ3IW8PfQL2/jJX6i2rbvT ZK985fnFz6SkheLp+kGiBdtwSk1FVMOszqOfKkPm90DLuTSWyKcP6vtJhP6JIze2Lz HkhcuAwaa5avz6hbIrqNv08lYBghgnsmLsS7iOZ4= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/32667] block copy with exact overlap is expanded as memcpy Date: Tue, 28 Nov 2023 11:03:15 +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: rguenth 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=3D32667 --- Comment #54 from Richard Biener --- (In reply to post+gcc from comment #52) > For the point discussed earlier with the `restrict` in the musl memcpy, I > had another look at the definition of `restrict` and it's not entirely cl= ear > to me any more that there is UB here. The restrict rules only apply to > objects that are "also modified (by any means)". Now the question is, does > "*X =3D *X" modify the object? Is a write always a modification or only i= f the > stores representation changes or only if the stored value changes? >=20 > If it requires a representation change, then "memcpy(x, x, n)" does not > modify anything, and hence there is no UB from "restrict". Heh, interesting splitting of hairs ;) I guess you need to file a DR with = the language to resolve this question ...=