public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: John Scott <jscott@posteo.net>, libc-alpha@sourceware.org
Subject: Re: [PATCH] manual: remove an obsolete requirement on aligned_alloc() usage
Date: Mon, 25 Oct 2021 20:34:57 -0600	[thread overview]
Message-ID: <c34d1708-6db1-bac6-33ad-e503a7daf282@gmail.com> (raw)
In-Reply-To: <ba8a6ea6-61b2-6bce-d5c3-1a8117c4c755@cs.ucla.edu>

On 10/25/21 7:50 PM, Paul Eggert wrote:
> On 10/25/21 08:45, Martin Sebor via Libc-alpha wrote:
>> Based on my code inspection of _mid_memalign in malloc.c I think
>> a change that would more accurately reflect the implementation
>> is one that described that when alignment is not a power of two
>> it's bumped up to next larger power of two, and adjusted
>> the EINVAL condition appropriately.
> 
> Let's not document this implementation detail, as it might tie us down 
> unnecessarily in the future.
> 
>> I believe the DR460 change went into C17.  Here's an early C2x
>> draft from 2018 publicly available on the WG14 site that should
>> still be very close to C17:
>>
>>   http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2310.pdf
> 
> This says that aligned_alloc "shall fail" if the alignment is not a 
> valid alignment supported by the implementation. This means the current 
> glibc alloc_aligned behavior does not conform to C17 and should be fixed 
> so that it does. Something like the attached (untested) patch, say.

I agree.  I took the term "valid alignment" here to mean one
specifically accepted by aligned_alloc() but 6.2.8 is explicit
that

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

so although implementations get to decide on the set of valid
extended alignments they're not allowed to be accept ones that
are in conflict with the blanket requirement above.

Martin

      reply	other threads:[~2021-10-26  2:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21  9:28 John Scott
2021-10-21 15:41 ` Alejandro Colomar (man-pages)
2021-10-25 15:45 ` Martin Sebor
2021-10-25 16:03   ` Martin Sebor
2021-10-26  1:50   ` Paul Eggert
2021-10-26  2:34     ` Martin Sebor [this message]

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=c34d1708-6db1-bac6-33ad-e503a7daf282@gmail.com \
    --to=msebor@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=jscott@posteo.net \
    --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).