Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nakEd-00046Z-3r for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Apr 2022 20:20:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nakEb-0003uF-O0 for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Apr 2022 20:20:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nakEb-0003u5-AX for pgsql-hackers@lists.postgresql.org; Sat, 02 Apr 2022 20:20:33 +0000 Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nakEY-0001wl-Vw for pgsql-hackers@postgresql.org; Sat, 02 Apr 2022 20:20:32 +0000 Received: by mail-il1-x12e.google.com with SMTP id z10so4283056iln.0 for ; Sat, 02 Apr 2022 13:20:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2ogMAPXPy2rVwX/E6rkbzCSanf7TTMV3G7qYX/Mpgi0=; b=JzEskcBZ1crCUx7kjf+orDBVMs5QVgMR5QDuOF5fisA68CXushMXZ2/hQGbjgfFS5b 6kFKhe+Q0xD9o0ZvBGPS8cISVPPx7RrVqpsNUysj8pXVv36n4JhyYCfetkPFEgnDqiiB FdAn1/mYBZHULWJeXZ9QT6baZ2AgkPDaFbCPzIBEclNTPcO4zij93eAdB1FBWJP87SS/ +lYzV9TKr46zQ66qXTheTkd6vSCHlGhtIHf+GWi/Y92RynRwXMO61+DnqRTbM8VVXgsQ wbQs5VQA94yChQRNw9u+0qL9Zsrv9vow6W4xjOYgx1rIr9mQhRVbHC6v5qBeNR5x4xW1 xYaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2ogMAPXPy2rVwX/E6rkbzCSanf7TTMV3G7qYX/Mpgi0=; b=j91igRYWx74w1q2yWtMTNJzvYDpM1rNyecHWfYh+8EXwZD/84vU0Z8AhM4q5MXZ4MD h0M5PkGVuDP4AOM2R99RlGHnmIiAcHwYB04xTd8Zrw8dTl3JD+1Ei0em16oBLAsB+zNG Iz1fFY1oojRiraEeumxNyYU9QI/bxWXXYWxLWfriy9eLnlaNXlNkSCQbz3FvaC4y/8oJ tED0y9oXOnyXT8/3OgXbvIhpq0epRMgUku0ReUbkCYkZ0erqsSlQE3K6g5Z0t+guFaVL iOExl9hfFh0WNLwo/kC2C7woUisihPUMXpw0iV6wUA6qa8diiaXDXdmp7LfZhI9FdLjt OjEQ== X-Gm-Message-State: AOAM5328qdV8K7S2pxu2Ou68YMAKIQwa57ctV9k0Pe8ugk3GujDFy7mu JsI5Z1Eg4GPXCv9hRkQ0M7PaOw== X-Google-Smtp-Source: ABdhPJyKnQhBFuMRsMJmI/4PhpciUge0EvoxbpDfYAMtdYGAGRwBhdVouBnPCBQMLHNloZgqUj8EUQ== X-Received: by 2002:a05:6e02:16cc:b0:2ca:e74:a551 with SMTP id 12-20020a056e0216cc00b002ca0e74a551mr2247356ilx.277.1648930829211; Sat, 02 Apr 2022 13:20:29 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id u15-20020a056e021a4f00b002c665afb993sm3347815ilv.11.2022.04.02.13.20.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Apr 2022 13:20:28 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id BF4708019CF; Sat, 2 Apr 2022 15:20:27 -0500 (CDT) Date: Sat, 2 Apr 2022 15:20:27 -0500 From: Justin Pryzby To: John Naylor Cc: Thomas Munro , Peter Geoghegan , pgsql-hackers@postgresql.org, Robert Haas Subject: Re: A qsort template Message-ID: <20220402202027.GG28503@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Apr 02, 2022 at 06:41:30PM +0700, John Naylor wrote: > On Sat, Apr 2, 2022 at 5:27 PM Thomas Munro wrote: > > Reproduced locally, using the same few lines from the cluster.sql > > test. I'll try to dig more tomorrow... > > Thanks! Unfortunately I can't reproduce locally with clang 13/gcc 11, > with -Og or -O2 with CFLAGS="-fsanitize=undefined,alignment" ... Like Thomas just said, I had to use: CFLAGS="-Og -fsanitize=undefined,alignment -fno-sanitize-recover=all I'm a couple few steps out of my league here, but it may be an issue with: commit 4ea51cdfe85ceef8afabceb03c446574daa0ac23 Author: Robert Haas Date: Mon Jan 19 15:20:31 2015 -0500 Use abbreviated keys for faster sorting of text datums. This is enough to avoid the crash, which might be a useful hint.. @@ -4126,22 +4126,23 @@ copytup_cluster(Tuplesortstate *state, SortTuple *stup, void *tup) /* * set up first-column key value, and potentially abbreviate, if it's a * simple column */ + stup->isnull1 = false; if (state->indexInfo->ii_IndexAttrNumbers[0] == 0) return; original = heap_getattr(tuple, state->indexInfo->ii_IndexAttrNumbers[0], state->tupDesc, &stup->isnull1);