mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Tamir Duberstein <tamird@google.com>
To: enh <enh@google.com>
Cc: musl@lists.openwall.com, NRK <nrk@disroot.org>,
	Rich Felker <dalias@libc.org>
Subject: Re: [musl] undefined behavior in fread.c
Date: Fri, 24 Feb 2023 12:32:05 -0500	[thread overview]
Message-ID: <CAK-_uh724wZKx7S3bD4T11ZMk=3kF+Vmyk9mhfkBuYf-pSRdHQ@mail.gmail.com> (raw)
In-Reply-To: <CAJgzZorOVSuMitQB5zk280eVf-4u21qjm5fOMD8Wg+XRvRmd4Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1557 bytes --]

Clang's qualifiers fail to parse in GCC, so __attribute__((nonnull (1)))
seems like the only somewhat portable solution.

Would you folks actually consider using it?

On Fri, Feb 24, 2023 at 12:07 PM enh <enh@google.com> wrote:

>
>
> On Fri, Feb 24, 2023 at 9:00 AM Jₑₙₛ Gustedt <jens.gustedt@inria.fr>
> wrote:
>
>> Tamir,
>>
>> on Fri, 24 Feb 2023 11:42:30 -0500 you (Tamir Duberstein
>> <tamird@google.com>) wrote:
>>
>> > Internal UB means "applying zero offset to null pointer" when the
>> > caller passes (NULL, _, 0, _).
>>
>> So you mean internal misbehavior?
>>
>> > Does such an attribute exist?
>>
>> Yes, gcc has the nonnull old-style attribute, and I think that the C23
>> versions of gcc and clang will have something like `[[gnu::nonnull]]`.
>>
>> Having this as attribute of the function and not of the pointer is a
>> bit unfortunate. For non-void pointers you could also use the `[static
>> 1]` array parameter notation instead of a pointer.
>>
>
> bionic's using clang's _Nullable and _Nonnull, which do let you express
> this:
> https://clang.llvm.org/docs/AttributeReference.html#nullability-attributes
>
>
>> Jₑₙₛ
>>
>> --
>> :: ICube :::::::::::::::::::::::::::::: deputy director ::
>> :: Université de Strasbourg :::::::::::::::::::::: ICPS ::
>> :: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus ::
>> :: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536
>> <+33%203%2068%2085%2045%2036> ::
>> :: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
>>
>

[-- Attachment #2: Type: text/html, Size: 2682 bytes --]

  reply	other threads:[~2023-02-24 17:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 12:52 Tamir Duberstein
2023-02-24 13:34 ` Rich Felker
2023-02-24 13:53   ` Jₑₙₛ Gustedt
2023-02-24 13:55   ` NRK
2023-02-24 14:07     ` Rich Felker
2023-02-24 14:17       ` NRK
2023-02-24 14:42         ` Tamir Duberstein
2023-02-24 15:13           ` NRK
2023-02-24 16:12             ` Tamir Duberstein
2023-02-24 16:40               ` Jₑₙₛ Gustedt
2023-02-24 16:42                 ` Tamir Duberstein
2023-02-24 17:00                   ` Jₑₙₛ Gustedt
2023-02-24 17:07                     ` enh
2023-02-24 17:32                       ` Tamir Duberstein [this message]
2023-02-24 16:42                 ` enh
2023-02-24 20:07                 ` Rich Felker

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='CAK-_uh724wZKx7S3bD4T11ZMk=3kF+Vmyk9mhfkBuYf-pSRdHQ@mail.gmail.com' \
    --to=tamird@google.com \
    --cc=dalias@libc.org \
    --cc=enh@google.com \
    --cc=musl@lists.openwall.com \
    --cc=nrk@disroot.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).