From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9CC31385843B; Wed, 29 Nov 2023 06:53:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9CC31385843B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701240785; bh=nxWSZX+5kk5zvi62r+7TAyUEbaUA9CvBSlBF3W9AmRw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DYstzMjHwFnOLbtUpLuOOtl8s4nHn5duqemwlu8+Hjk+CEhSGpdtMBDIRb6ThKGJS 3RkAPr7AJ8yJNB07K41A7qGpPxC25Vt+qK1ms4lCPS5NVuJZP1tf/Pj7gIfTQp0OoA +Cv8mLDFPDTsoWC2y/Zhyvd9M3Rn9yxIzm6vfCX4= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/112748] memmove(ptr, ptr, n) call optimized out even at -O0 with -fsanitize=undefined Date: Wed, 29 Nov 2023 06:53:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: documentation 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: bug_status keywords cc everconfirmed component cf_reconfirmed_on 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=3D112748 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Keywords| |documentation CC| |dodji at gcc dot gnu.org, | |dvyukov at gcc dot gnu.org, | |jakub at gcc dot gnu.org, | |kcc at gcc dot gnu.org, | |marxin at gcc dot gnu.org Ever confirmed|0 |1 Component|middle-end |sanitizer Last reconfirmed| |2023-11-29 --- Comment #3 from Richard Biener --- Confirmed. We fold all calls early after gimplification and folding is kno= wn to also affect -O0. This behavior is independent of sanitizing which happe= ns partly before and partly only after this folding takes place. We also simplify 1 + 1 or x + 0 with -O0 or turn printf("%s", "Hello") into puts("Hello") for example. Documenting this behavior might be good. Gating some of the simplifications on optimization might be also reasonable.=