Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1exzOi-0006ad-CC for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Mar 2018 18:20:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1exzOh-0002Fc-CH for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Mar 2018 18:20:39 +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.89) (envelope-from ) id 1exzOh-0002FR-2e for pgsql-bugs@lists.postgresql.org; Mon, 19 Mar 2018 18:20:39 +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 1exzOe-0005R8-KK for pgsql-bugs@lists.postgresql.org; Mon, 19 Mar 2018 18:20:37 +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 w2JIKXjd010574; Mon, 19 Mar 2018 14:20:33 -0400 From: Tom Lane To: Tomas Vondra cc: =?UTF-8?Q?Martin_Li=c5=a1ka?= , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15121: Multiple UBSAN errors In-reply-to: <7f798f51-05c4-304a-f852-9cea35f5f095@2ndquadrant.com> References: <152140318583.11955.7731957058248462341@wrigleys.postgresql.org> <7df78014-c931-6c75-6f92-ec48f390b2b9@2ndquadrant.com> <46a345c1-1f8d-fd0d-c334-d8ca577719a9@2ndquadrant.com> <7f798f51-05c4-304a-f852-9cea35f5f095@2ndquadrant.com> Comments: In-reply-to Tomas Vondra message dated "Mon, 19 Mar 2018 19:07:49 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <10572.1521483633.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 19 Mar 2018 14:20:33 -0400 Message-ID: <10573.1521483633@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra writes: > On 03/19/2018 03:28 PM, Martin Li=C5=A1ka wrote: >>>> Note that building postgresql with -03, I see some array tests failin= g. > I'm getting failures in errors, union and alter_table, but none of those > are related to arrays. So, which tests are failing for you and how do > the failures look like? I tried -O3 with gcc 7.3.1 (Fedora 26), and that passes check-world just fine. Then I tried -O3 with gcc 8.0.1 (prerelease Fedora 28), and indeed that's got some problems. It looks like array_out fails for multidimensional arrays, because all the diffs look about like this one: *** 106,116 **** SET c[2:2] =3D '{"new_word"}' = = WHERE array_dims(c) is not null; = = SELECT a,b,c FROM arrtest; = = ! a | b | c = = ! ---------------+-----------------------+------------------- = = ! {16,25,3,4,5} | {{{113,142},{1,147}}} | {} = = ! {} | {3,4} | {foo,new_word} = = ! {16,25,23} | {{3,4},{4,5}} | {foobar,new_word} = = (3 rows) = = = = SELECT a[1:3], = = --- 106,116 ---- SET c[2:2] =3D '{"new_word"}' = = WHERE array_dims(c) is not null; = = SELECT a,b,c FROM arrtest; = = ! a | b | c = = ! ---------------+---------------+------------------- = = ! {16,25,3,4,5} | {{ | {} = = ! {} | {3,4} | {foo,new_word} = = ! {16,25,23} | {{3,4},{4,5}} | {foobar,new_word} = = (3 rows) = = = = SELECT a[1:3], = = Note that 1-D and 2-D arrays print fine, it's only 3-D or deeper that print wrong. Very odd. Maybe it's bad code on our part, but I think the odds are at least as good that it's a new gcc bug. regards, tom lane