public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/113082] builtin transforms do not honor errno
Date: Tue, 19 Dec 2023 08:34:02 +0000	[thread overview]
Message-ID: <bug-113082-4-iDnzx2ohzJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113082-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113082

--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 19 Dec 2023, fw at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113082
> 
> --- Comment #2 from Florian Weimer <fw at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #1)
> > Joseph - I wonder if the standard folks can be convinced to amend most
> > library function documentation as to not altering 'errno' (like memcpy,
> > strlen, etc.)?
> > 
> > Should we simply document our constraints on supported library
> > implementations?
> 
> We can add attributes to the glibc headers, similar to the throw and leaf
> annotation we have today. It would act as a reminder that if we clobber errno
> in these functions due to some implementation detail, we need to save/restore
> errno.

I guess a new 'noerrno' attribute would make sense.  What I've always
wanted is also a reliable way to distinguish accesses to 'errno'
from other accesses (unfortunately 'errno' is an lvalue so it's
address can be taken).  glibc uses __errno_location (), so an
additional attribute indicating the function returns the address
of 'errno' would be nice to have as well ('errno', just like we
have 'malloc' for malloc results?).  At the moment we can just
use TBAA ('errno' is an lvalue of type 'int') for disambiguation
but 'int' is a bit generic for that to be of much help.

  parent reply	other threads:[~2023-12-19  8:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19  8:05 [Bug middle-end/113082] New: " rguenth at gcc dot gnu.org
2023-12-19  8:08 ` [Bug middle-end/113082] " rguenth at gcc dot gnu.org
2023-12-19  8:13 ` fw at gcc dot gnu.org
2023-12-19  8:34 ` rguenther at suse dot de [this message]
2023-12-19 15:00 ` amonakov at gcc dot gnu.org
2023-12-19 19:22 ` joseph at codesourcery dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113082-4-iDnzx2ohzJ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).