From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7F5CE385840D; Tue, 19 Dec 2023 19:23:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F5CE385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703013782; bh=RVfd5EdewBVm3SpzMDofJdnwr/mCSYLRIYo6MRfBTjU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bjs4nFqWbH/WVzCjpIBcfPNufqKP3GsjAPq9ZzbAqOBQhvD/zYmFzuICGnuVbdt2p HQdHSdgMLAvF56ejOT/uEGnd0jMYqYV8LtLUX9iLJRlNRDaLwja4eAUib9LkaECCW/ aknvjuWHOBZQJlfF7mBwcgzevbRLmo7J9lEYp/Wg= From: "joseph at codesourcery dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/113082] builtin transforms do not honor errno Date: Tue, 19 Dec 2023 19:22:59 +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: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: joseph at codesourcery dot com 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=3D113082 --- Comment #5 from joseph at codesourcery dot com --- I think it would be reasonable for glibc to require that audit modules=20 don't change errno, at least when acting for libc function calls where=20 glibc guarantees not changing errno. I think user-provided IFUNC=20 resolvers are only relevant for user-provided functions and so shouldn't=20 be relevant to this issue (if a user declares their own function with a=20 noerrno attribute, and also has an IFUNC resolver for that function, they=20 need to make sure the IFUNC resolver behaves consistently with the=20 attribute). It would also seem reasonable for glibc to guarantee that most string and=20 memory functions (maybe excluding a few that involve the locale or other=20 external state, such as strcoll or strerror, and definitely excluding=20 those such as strdup that involve memory allocation) don't change errno.=20= =20 We may need to be careful about what "obviously" shouldn't affect errno=20 (consider e.g. the ongoing discussions around qsort - where avoiding=20 memory allocation should as a side effect also avoid affecting errno, but=20 it's unclear how we might simultaneously avoid memory allocation, keep a=20 stable sort, achieve O(n log(n)) worst case performance, and keep good=20 performance for typical inputs).=