Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieZnR-0000P4-Ua for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Dec 2019 07:19:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ieZnP-0008Pz-8F for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Dec 2019 07:18:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieZnO-0008Ps-RU for pgsql-bugs@lists.postgresql.org; Tue, 10 Dec 2019 07:18:59 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ieZnJ-0003ki-2A for pgsql-bugs@lists.postgresql.org; Tue, 10 Dec 2019 07:18:55 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 69D0921C47FD; Tue, 10 Dec 2019 10:18:51 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.0.108] (pool-77-222-111-80.is74.ru [77.222.111.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 2472921C418B; Tue, 10 Dec 2019 10:18:50 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1575962331; bh=DRDYb92JXaFkFKsIdt/osYOgoRvf3Pe1YBAVMDmJ1o0=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=fJMBcKXeFMHXs/tGOJi8F/nQi+fEwF1nn0JZqNHsoXtaP2WFAydZlfAdz+OrUG5LR otf4yj6N3DSOxQQyfch7snCsqEnaTEWsOzLZYQaFUW+FVW2NTar3bBeCR2aczqpcWG zkKTtoL8GYgZx33E/52PZT5w3RRgGdkYT1sI939U= Subject: Re: Warning in the RecordTransactionAbort routine during compilation with O3 flag To: Michael Paquier Cc: PostgreSQL mailing lists References: <20191209080316.GA72921@paquier.xyz> <287cdd37-4021-da81-0378-cd367a279577@postgrespro.ru> <20191210031328.GG72921@paquier.xyz> From: Andrey Lepikhov Organization: Postgres Professional Message-ID: <04868ee5-4d76-2798-0010-0f4b478e7762@postgrespro.ru> Date: Tue, 10 Dec 2019 12:18:49 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <20191210031328.GG72921@paquier.xyz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 10.12.2019 08:13, Michael Paquier wrote: > On Mon, Dec 09, 2019 at 02:03:43PM +0500, Andrey Lepikhov wrote: >> We already have assertion on the twophase_gid variable. But compiler is not >> so smart and can't find a link between the XACT_XINFO_HAS_GID flag and >> state of twophase_gid pointer. > > Well, gcc-9 got visibly smarter on that point :) > >> Ok. In accordance with your review, I have prepared a new version of the >> patch. > > Regarding formatting.c, I can see the point of avoiding future > mistakes, and I would go a bit further as per the attached for > consistency between all variables. have_error is a bit trickier > though as it gets moved around more layers so doing an initialization > in the middle is not really an option. Anyway, we can do that rather > cleanly from the entry point of do_to_timestamp() to bring more > consistency for variables which are always expected and the optional > ones. What do you think? I have small experience in formatting.c code. But this patch and idea looks good. > > For the second one in xact.c, I am not really on board of doing > something based on the proposals because this reduces the code > visibility, and gcc is clearly wrong in its assumptions because the > state cannot be reached. Ok. I switched to gcc-9 and now have no problem. -- Andrey Lepikhov Postgres Professional https://postgrespro.com The Russian Postgres Company