From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 463E93858438; Tue, 19 Dec 2023 02:07:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 463E93858438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702951627; bh=jfiCfp5lTpmV6IhoVf9XlB7Z/LX/DCB6B2PEfNqclZM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TkKJMeJxg7CXs1YHrEvM2P7lOvu3qbbGcmWryjdNF+F185d0PJEy8esPF6JuCQ1YE aY/Bf+kv3sWY0P6uQQiip8R0+y3n9lthu9pNiny83AMAt6/SRCNa9USM/Qt0118e2X 5oQsE2DnY3dS50z6DjCNYCARNcEB0q4+YnGCXxEA= From: "terra at gnome dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/56888] memcpy implementation optimized as a call to memcpy Date: Tue, 19 Dec 2023 02:07:05 +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.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: terra at gnome dot org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth 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=3D56888 --- Comment #48 from M Welinder --- It's your (1). gcc is changing a program that can rely on errno not being changed to one where the C library can change it. (The current C library or any future library that the resulting binary may be dynamically linked against.) Consider code like this fd =3D open(filename, ...); if (fd < 0) { fprintf(stderr, "%*s: %s\n", MIN(20, mystrlen (filename)), ; filename, strerror(errno)); ...; } If the C library is in a bad mood you will print the wrong error message. strlen isn't the obvious candidate for a C library function changing errno,= but I can see an instrumented library do it. Is there any real-world situation that benefits from introducing these call= s?=20 It has the feel of optimizing for a benchmark.=