public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Paul Eggert <eggert@cs.ucla.edu>, libc-alpha@sourceware.org
Subject: Re: [PATCH v4 1/6] stdlib: Optimization qsort{_r} swap implementation (BZ 19305)
Date: Thu, 13 Jul 2023 16:13:53 +0300 (MSK)	[thread overview]
Message-ID: <a57770cf-8c3e-95aa-a61c-04bd42f36f05@ispras.ru> (raw)
In-Reply-To: <9c33143c-c100-225e-0638-ac7a6291a261@linaro.org>

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


On Thu, 13 Jul 2023, Adhemerval Zanella Netto via Libc-alpha wrote:

> >> +  if (is_aligned (pbase, size, sizeof (uint64_t)))
> >> +    swap_func = SWAP_WORDS_64;
> > 
> > alignof not sizeof, in contexts like these that are talking about alignment not size.
> 
> Indeed, I will fix it.

Are you going to use GNU __alignof, or C11 _Alignof? One is safe. The other
makes the code go *boom* on 32-bit x86 when 'size' is 4 modulo 8, coming
this || close to a sneaky singular out-of-bounds write, saved only by the
fact that gcc doesn't (yet) do high-level transforms in swap_words_64.

(the code is not, in fact, talking solely about alignment there)

Alexander

  reply	other threads:[~2023-07-13 13:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11 19:07 [PATCH v4 0/6] Use introsort for qsort Adhemerval Zanella
2023-07-11 19:07 ` [PATCH v4 1/6] stdlib: Optimization qsort{_r} swap implementation (BZ 19305) Adhemerval Zanella
2023-07-11 23:40   ` Noah Goldstein
2023-07-12 19:40     ` Adhemerval Zanella Netto
2023-07-12 21:04   ` Paul Eggert
2023-07-13 11:07     ` Adhemerval Zanella Netto
2023-07-13 13:13       ` Alexander Monakov [this message]
2023-07-13 13:29         ` Adhemerval Zanella Netto
2023-07-11 19:07 ` [PATCH v4 2/6] stdlib: Move insertion sort out qsort Adhemerval Zanella
2023-07-11 23:46   ` Noah Goldstein
2023-07-12  7:28     ` Andreas Schwab
2023-07-12 20:35     ` Adhemerval Zanella Netto
2023-07-11 19:07 ` [PATCH v4 3/6] stdlib: qsort: Move some macros to inline function Adhemerval Zanella
2023-07-11 23:44   ` Noah Goldstein
2023-07-12 20:45     ` Adhemerval Zanella Netto
2023-07-11 19:07 ` [PATCH v4 4/6] stdlib: Implement introsort with qsort Adhemerval Zanella
2023-07-12  5:39   ` Alexander Monakov
2023-07-12 20:55     ` Adhemerval Zanella Netto
2023-07-12 21:55   ` Paul Eggert
2023-07-13 11:53     ` Adhemerval Zanella Netto
2023-07-11 19:07 ` [PATCH v4 5/6] stdlib: Remove use of mergesort on qsort (BZ 21719) Adhemerval Zanella
2023-07-12 22:04   ` Paul Eggert
2023-07-13 11:55     ` Adhemerval Zanella Netto
2023-07-11 19:07 ` [PATCH v4 6/6] stdlib: Add more qsort{_r} coverage Adhemerval Zanella

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=a57770cf-8c3e-95aa-a61c-04bd42f36f05@ispras.ru \
    --to=amonakov@ispras.ru \
    --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).