public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	Paul Eggert <eggert@cs.ucla.edu>
Cc: libc-alpha@sourceware.org
Subject: Re: [patch] aligned_alloc: conform to C17
Date: Thu, 16 Mar 2023 20:00:56 -0400	[thread overview]
Message-ID: <xno7os2qmf.fsf@greed.delorie.com> (raw)
In-Reply-To: <3d314630-5ba2-65eb-06c1-50a4966516ca@linaro.org>

Adhemerval Zanella Netto via Libc-alpha <libc-alpha@sourceware.org>
writes:
> Hi D.J, this patch does not build correctly [1].  Maybe you send it too soon?

Sigh, fixing...

also, it's DJ not D.J.

>> +  GLIBC_2.38 {
>> +    __libc_aligned_alloc;
>> +  }
> How is is actually used? There is no redirection in the header if -std=c17 is used,
> nor any abilist update.

aligned_alloc() used to be a weak alias to _libc_memalign but since they
now do different things, I changed it to a weak alias to
_libc_aligned_alloc.  I put the new symbol in so that it's the same as
the old symbol.

Ug, I need to update all the .abilist files too...

Paul Eggert <eggert@cs.ucla.edu> writes:
> powerof2 (0) == 1, unfortunately. Does the C standard let aligned_alloc 

_mid_memalign enforces a minimum alignment so this isn't an issue, other
than the pedantry of whether 0 is an iso-valid alignment.

I suspect fixing the macro might be more generally useful than fixing
this edge case, but I haven't looked for any potential side-effects.

As for "non-negative alignment" I assume they mean "passing a negative
number as `alignment' to aligned_alloc()", not referring to the power of
two itself.

 "Every valid alignment value shall be a nonnegative integral power of
 two."

but alignments are also to be represented by type size_t, which is
integral and unsigned, so no interpretation of "nonnegative integral
power of two" even makes sense, other than the pedantic align=zero.

The only other hint is this one:

 "The types char, ... shall have the weakest alignment requirement."

That's align=1, implying that align=0 cannot be a valid alignment.


  reply	other threads:[~2023-03-17  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 20:48 DJ Delorie
2023-03-16 21:00 ` Adhemerval Zanella Netto
2023-03-17  0:00   ` DJ Delorie [this message]
2023-03-17  6:33     ` Paul Eggert
2023-03-17 19:55       ` DJ Delorie
2023-03-16 22:00 ` Paul Eggert

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=xno7os2qmf.fsf@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=eggert@cs.ucla.edu \
    --cc=libc-alpha@sourceware.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).