public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: Jonny Grant <jg@jguk.org>,
	 Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	 GNU C Library <libc-alpha@sourceware.org>,
	 Xi Ruoyao <xry111@xry111.site>
Subject: Re: glibc misc/sys/cdefs.h nonull - typo in comment
Date: Wed, 01 Nov 2023 08:38:16 +0100	[thread overview]
Message-ID: <87cywtvs7r.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <84e4081c-35ef-4f2d-89d0-0fea04732737@cs.ucla.edu> (Paul Eggert's message of "Sat, 28 Oct 2023 22:24:14 -0700")

* Paul Eggert:

> The April 2023 working draft of C23 has adjusted the wording to be the 
> following, and I expect POSIX to follow suit eventually. Notice the new 
> restrictions:
>
> "If an argument to a function has an invalid value (such as a value 
> outside the domain of the function, or a pointer outside the address 
> space of the program, or a null pointer, or a pointer to non-modifiable 
> storage when the corresponding parameter is not const-qualified) or a 
> type (after default argument promotion) not expected by a function with 
> a variable number of arguments, the behavior is undefined.
>
> "If a function argument is described as being an array, the pointer 
> actually passed to the function shall have a value such that all address 
> computations and accesses to objects (that would be valid if the pointer 
> did point to the first element of such an array) are in fact valid.[210]
>
> "[210] This includes, for example, passing a valid pointer that points 
> one-past-the-end of an array along with a size of 0, or using any valid 
> pointer with a size of 0."

I'm not sure if these are new restrictions.  Doesn't this make
previously undefined behavior when calling strncmp with shorter
strings defined?

  parent reply	other threads:[~2023-11-01  7:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11  9:09 Jonny Grant
2023-04-11 13:39 ` Adhemerval Zanella Netto
2023-04-12 15:56   ` Jonny Grant
2023-04-12 16:26     ` Xi Ruoyao
2023-04-12 16:31       ` Xi Ruoyao
2023-10-28 23:50       ` Jonny Grant
2023-10-29  5:24         ` Paul Eggert
2023-10-29 22:43           ` Jonny Grant
2023-10-30  9:04             ` Andreas Schwab
2023-10-30 10:10               ` Xi Ruoyao
2023-12-03 22:09                 ` Jonny Grant
2023-11-01  7:38           ` Florian Weimer [this message]
2023-11-01 19:30             ` Paul Eggert
2023-11-01 19:52               ` Jonny Grant
2023-11-01 20:05                 ` Florian Weimer
2023-11-01 20:16                   ` Jonny Grant
2023-11-01 20:06               ` Florian Weimer
2023-04-12 17:28     ` Adhemerval Zanella Netto

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=87cywtvs7r.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=adhemerval.zanella@linaro.org \
    --cc=eggert@cs.ucla.edu \
    --cc=jg@jguk.org \
    --cc=libc-alpha@sourceware.org \
    --cc=xry111@xry111.site \
    /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).