From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 50AEC3858C3A for ; Thu, 13 Jul 2023 13:29:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 50AEC3858C3A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6b9a2416b1cso623500a34.2 for ; Thu, 13 Jul 2023 06:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689254956; x=1691846956; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=ILpnDEsRkuoBfrblttahIclCclmI/NyfpnAEoiPU4ig=; b=fPLHLRfcMln5XFkI4hnWPxkgcRT5yQSgZrflCASBkYJsWXGDRE6HECHviBpw/n9u2u DUkefjBQxFh1s5noleHYO07m4dDqp8BG8aT/Jeb38P7zHoZhIzEggiZGM5hyJ86kju0x pyNoemOg4mFyfk4IMFd8lw5+g6AJpbRJKFg9acTKI4tHARP/5Og2ZyzZ45LO8U4xUul7 XbRMed2HyATP2x/dlRt65rv/mP3X8oVwl0njiktqWYoKJderkZAMKUCFJ39CqMttKXQB 6jufW+ga99HEnNZ/jTrNtFdIHIpwWUB3mCWlAejOHDUmfSW6cMbHFCB25IyKHt5ap53t yk8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689254956; x=1691846956; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ILpnDEsRkuoBfrblttahIclCclmI/NyfpnAEoiPU4ig=; b=hJN09AVUEefvRv5ylLdgiiR6xKydL0rVwXkKarNuz7ncahZoViObH1/HGxdhP1JRat dPDfj8h77g8W3UyZl9LAdfnTC4VRV3/HRKPZUrp7dwWet0DTluEPRv7eDUy55juQ7GNW quHb5iRpMQnS5AyLrFodeFYaPZVP5oDxB9/2+TrQ/DyKe6aEoAAJ7GSyBF5WmPPGJIHI 67MTic7FSONoikUYHW4X42UDf1a29egrHmwEM61To1m8nPyWh43lAraZPJ1UNSt0A8+X 5bnR7gMf5RCEje05dfNHaQ7WetnnxlbALqZOyERAaFPuv+iwGq/m2eZaRV6muGdCOmLn Y0VQ== X-Gm-Message-State: ABy/qLYdk48aoLHW0B0vLNZUSxOmIk5a/MzfiSX852Z2NHSgtko/WxtV o0SzKSyNtibNL5BJK7I3faOKlA== X-Google-Smtp-Source: APBJJlG6nWMCpHGN5OrEyFmOJeA+sOkzGbmAnIMu+cNIlGSl+WLmNu+BZo/8/FIedpR5jgQi8BVg+w== X-Received: by 2002:a9d:628e:0:b0:6b9:9052:155d with SMTP id x14-20020a9d628e000000b006b99052155dmr2013931otk.2.1689254956523; Thu, 13 Jul 2023 06:29:16 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c0:5656:7092:f1f:c564:8df7? ([2804:1b3:a7c0:5656:7092:f1f:c564:8df7]) by smtp.gmail.com with ESMTPSA id j25-20020a9d7d99000000b006b29a73efb5sm2854089otn.7.2023.07.13.06.29.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Jul 2023 06:29:16 -0700 (PDT) Message-ID: <4846cb13-2651-cd13-2859-30f3a6c6f4c5@linaro.org> Date: Thu, 13 Jul 2023 10:29:13 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v4 1/6] stdlib: Optimization qsort{_r} swap implementation (BZ 19305) Content-Language: en-US To: Alexander Monakov Cc: Paul Eggert , libc-alpha@sourceware.org References: <20230711190722.4028821-1-adhemerval.zanella@linaro.org> <20230711190722.4028821-2-adhemerval.zanella@linaro.org> <01eee84c-d5e6-a5a0-79be-e5b58ca6e541@cs.ucla.edu> <9c33143c-c100-225e-0638-ac7a6291a261@linaro.org> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 13/07/23 10:13, Alexander Monakov wrote: > > 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) Yes I noted if fails on i686, I will use explicit value instead (as Linux lib/sort.c does).