Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eETp7-0006Tn-Qq for pgsql-bugs@arkaria.postgresql.org; Tue, 14 Nov 2017 05:31:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eETp6-00017D-T8 for pgsql-bugs@arkaria.postgresql.org; Tue, 14 Nov 2017 05:31:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eETp6-000173-LI for pgsql-bugs@lists.postgresql.org; Tue, 14 Nov 2017 05:31:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eEToz-00020V-Rg for pgsql-bugs@postgresql.org; Tue, 14 Nov 2017 05:31:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vAE5VZSn023172; Tue, 14 Nov 2017 00:31:35 -0500 From: Tom Lane To: Michael Paquier cc: Dmitry Dolgov <9erthalion6@gmail.com>, Andres Freund , Peter Eisentraut , Vincent Lachenal , PostgreSQL mailing lists Subject: Re: [BUGS] BUG #14897: Segfault on statitics SQL request In-reply-to: References: <20171110185747.31519.28038@wrigleys.postgresql.org> <1415.1510340891@sss.pgh.pa.us> <5652.1510344738@sss.pgh.pa.us> <7710.1510346813@sss.pgh.pa.us> <10197.1510349123@sss.pgh.pa.us> <14075.1510352167@sss.pgh.pa.us> <17617.1510355215@sss.pgh.pa.us> <3192.1510508352@sss.pgh.pa.us> <10396.1510621709@sss.pgh.pa.us> <17615.1510630283@sss.pgh.pa.us> Comments: In-reply-to Michael Paquier message dated "Tue, 14 Nov 2017 14:20:25 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23170.1510637495.1@sss.pgh.pa.us> Date: Tue, 14 Nov 2017 00:31:35 -0500 Message-ID: <23171.1510637495@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > On Tue, Nov 14, 2017 at 12:31 PM, Tom Lane wrote: >> Concretely, the attached patch fixes it for me. I've verified by >> examining the assembly code that this stops gcc from using movdqa or >> movaps in numeric.c, except for one place where it apparently can >> prove that it's dealing with a sufficiently-aligned local variable. > I am not seeing any difference in the assembly code generated by gcc > -S with and without your patch. Perhaps I am missing something? What > are you actually seeing? Hm, double-check your procedure. I get this: $ diff numeric.s.std numeric.s.patch 2746c2746 < movaps %xmm0, (%r14) --- > movups %xmm0, (%r14) 13948,13951c13948,13951 < movdqa 16(%rbp), %xmm0 < movaps %xmm0, 16(%rax) < movdqa 32(%rbp), %xmm0 < movaps %xmm0, 32(%rax) --- > movdqu 16(%rbp), %xmm0 > movups %xmm0, 16(%rax) > movdqu 32(%rbp), %xmm0 > movups %xmm0, 32(%rax) 14434,14435c14434,14435 < movdqa 16(%rbp), %xmm0 < movaps %xmm0, 16(%rax) --- > movdqu 16(%rbp), %xmm0 > movups %xmm0, 16(%rax) (If using -g, there are a bunch more diffs in the debug tables.) regards, tom lane