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 1ey2HB-0008Je-Fy for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Mar 2018 21:25:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ey2HA-0004uG-E7 for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Mar 2018 21:25:04 +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 1ey2HA-0004u7-10 for pgsql-bugs@lists.postgresql.org; Mon, 19 Mar 2018 21:25:04 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ey2H6-0001nk-CE for pgsql-bugs@lists.postgresql.org; Mon, 19 Mar 2018 21:25:02 +0000 Received: by mail-wm0-x235.google.com with SMTP id r82so7885041wme.0 for ; Mon, 19 Mar 2018 14:24:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=a+OYeLXJS5A8Guii8naQ0ECRVU9WIlbtqjEmN9XoLL8=; b=XCgGg1iouc5M1GdDp1F7pCsC8UUb6n/fyHg/y9ZeUWiriFpTD/Br5IdHxYg62rytqK k8FWgbtFf4IzJ1GaYssgmOkWLMHPoc6V/h8S5N9ilKW1L49QK+M1g6jbHI45UycLFeNK n+f4qzD86EWWtwX6iMKaLU6JLnrl2cA7NJpsYrUDuLdx84FJV3QFG8oOuMuYiJ0h1Dl8 9SLWJPKehtEQrnpewF7IbRPSdn+jBnF1mmEvHWS3zLTfQOmim26GqsTSac+CotE+zfCN kE0lA7KpZ7GSr2yy6IZEc+2fAzxUOKZLbTFfozHkU5Y5jRAwJhScgt0aKp+Iio08Whh5 H+mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=a+OYeLXJS5A8Guii8naQ0ECRVU9WIlbtqjEmN9XoLL8=; b=rbJWTIlYYhpDbZ7MsQC+ghv/9A13FHSWbGm37DeZWvb2t3T5wrGSHVBl3RiCr3qMGc FIYbmTN6Md2iFLW6s+xuRazeagmgt957dow/OngP+gilbDh2432nticFXF59ZCIC8diU MXhBhnritK4+hVZVAV/P5fZIyIxQmBNNJSlZ5+9htsV1BQ70PN6xNTDTldFV8rp+CmQR QVF+G4+DcoHhVp+RpdSzSmZYNzi0l9xmWs1JIxKCdTuXiPGDi9ahrnj9Q6etWAPgxCRJ uHXlziTocbIOxEFm0eYno64/QHL3ZemmltFgJQWfwB9ewLMqaEwHOkkMPoZ28fA3Octx 8tsg== X-Gm-Message-State: AElRT7GSsCdaWicPjfQCMo2KP8Z5DrNqQWQ2sd+i/RliWyOahXCYgDCK LInQ/HsUHpgzQL5IOpPKv/orDlLbAWZm+3v4pHrQeBdxcoHEAusgvahrVm4x/+E6Q6WxITvDGDE gaUMvAhA+9uRtRS4sQtHFxYcQsoGzJQXVHAAhMALGOFExU0IrXOciO4K/7eHjD7mrbyZH5iJrlT sxBBCrYROScE5z X-Google-Smtp-Source: AG47ELvjaJaCw6UZdRSmC8tiqzjZHuFwpd2WKYDknKxfeF0a9sg2fF6VMyVTYmJTNF0wAuv27GPrPw== X-Received: by 10.28.48.149 with SMTP id w143mr196180wmw.88.1521494697980; Mon, 19 Mar 2018 14:24:57 -0700 (PDT) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id f22sm96602wmi.39.2018.03.19.14.24.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 14:24:56 -0700 (PDT) Subject: Re: BUG #15121: Multiple UBSAN errors To: Tom Lane Cc: =?UTF-8?Q?Martin_Li=c5=a1ka?= , pgsql-bugs@lists.postgresql.org 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> <10573.1521483633@sss.pgh.pa.us> From: Tomas Vondra Message-ID: <2e3ae9a4-d402-c553-b1d6-bc5dbe8734f8@2ndquadrant.com> Date: Mon, 19 Mar 2018 22:24:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <10573.1521483633@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 03/19/2018 07:20 PM, Tom Lane wrote: > Tomas Vondra writes: >> On 03/19/2018 03:28 PM, Martin Liška wrote: >>>>> Note that building postgresql with -03, I see some array tests failing. > >> 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] = '{"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] = '{"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. > Interesting. If I run the tests with "-03" I get the same failures in arrays. If I run them with "-O3 -fsanitize=undefined" I don't get any failures in arrays, but I get failures in errors, union and alter_table. I wouldn't expect -fsanitize=undefined to affect the results like this, but if it really is a compiler bug then all bets are off. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services