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 1ieE12-0005d3-Od for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Dec 2019 08:03:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ieE10-0004tP-EQ for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Dec 2019 08:03:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieE10-0004tH-2n for pgsql-bugs@lists.postgresql.org; Mon, 09 Dec 2019 08:03:34 +0000 Received: from [66.111.4.26] (helo=out2-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ieE0x-0003Ls-I0 for pgsql-bugs@lists.postgresql.org; Mon, 09 Dec 2019 08:03:32 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E386F2291A; Mon, 9 Dec 2019 03:03:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 09 Dec 2019 03:03:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=Ik1atua1U880BfdcZ0yXn5Hu9y+ tXZS2Qqk48Eaz7sw=; b=SVWzFVu7Xp1CW3sYlc3yyoRn4OwyKPK/pvddCGwQKwd 4JINVbTXwoCTRysuZLMd4SIDDhpfy/ElbxPH3oUFCNqkV5SvUUNCro69e9sVb0xK ewjy0oTytBSn+TCm122HDuaN5wNFqPTYfbhQChIoS8ufzA/lQ9uvEUBlFqo0vmW9 mSq1katSTz5+xwjlEZKifiA6rgq6Flgl9aByUey/SPxylnM1P2vZvtLe2PpjWKkX Y+86J+pb83TaKCcM1JwbebeRFmkaCneRVioAj8FxqlJkBwrmina1GO/bIPK8Nepi ocueNrt5re69hV4BN9YBlRbr88O/j3LY2ksDq1Lw/lQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Ik1atu a1U880BfdcZ0yXn5Hu9y+tXZS2Qqk48Eaz7sw=; b=BS2VqEwIHk6FFjSerM406K EkCEOMpDR0eNP/xC22a4BkWKpZuSUKi3mUfZoZSDCYV46/S4avsMK4M1XpO/XLOt 6+YdyBoOejmI57ZBlswkARiYWamHMHoStvFPkh9rRJ/aWSW53sxDF4jv+bFEiCv4 uVHTWCQVUmOVHxwtz1un2Ebx8Gy/joEq24il4RjXhTFbrfodtwGgZscvOl9yuLBc h8o0kr6IXDAJ9DgQdL95NQ3tCqiPHnY3nekOioRDDQC/RpUkDJrUetJXHKYGGBBO JJNbIV9Xi9DSN6Bcpp5VYnatXoI0YtwhgeA7Eycy7P78A66MBmMAwX5hA2xccteQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudekledgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredt tdejnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecukfhppeduuddurddutddvrddukedtrddukeehnecurfgr rhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiinecuve hluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 6EB5280061; Mon, 9 Dec 2019 03:03:19 -0500 (EST) Date: Mon, 9 Dec 2019 17:03:16 +0900 From: Michael Paquier To: Andrey Lepikhov Cc: PostgreSQL mailing lists Subject: Re: Warning in the RecordTransactionAbort routine during compilation with O3 flag Message-ID: <20191209080316.GA72921@paquier.xyz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="AqsLC8rIMeq19msA" Content-Disposition: inline In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.26 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --AqsLC8rIMeq19msA Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 09, 2019 at 08:49:26AM +0500, Andrey Lepikhov wrote: > xact.c: In function =E2=80=98RecordTransactionAbort=E2=80=99: > xact.c:5709:55: warning: argument 1 null where non-null expected [-Wnonnu= ll] > XLogRegisterData(unconstify(char *, twophase_gid), strlen(twophase_gi= d) > + 1); Assert(twophase_gid !=3D NULL); - - if (XLogLogicalInfoActive()) - xl_xinfo.xinfo |=3D XACT_XINFO_HAS_GID; =20 xlinfo is set in the first part logging the transaction commit and the record data is registered in the second, so I think that the original coding makes more sense than what you are suggesting. Perhaps it would help to just add an assertion on twophase_gid to make sure that it is not NULL in the part registering the data? After that we really have no bugs here, so it does not really help much.. > formatting.c: In function =E2=80=98parse_datetime=E2=80=99: > formatting.c:4229:13: warning: =E2=80=98flags=E2=80=99 may be used uninit= ialized in this > function [-Wmaybe-uninitialized] > if (flags & DCH_ZONED) - uint32 flags; + uint32 flags =3D 0; do_to_timestamp(date_txt, fmt, strict, &tm, &fsec, &fprec, &flags, have= _error); For this one, OK. Wouldn't it be better to initialize flags, fprec and have_error directly in do_to_timestamp if they are not NULL? This way future callers of the routine, if any, won't miss the initialization. By the way, are you using more specific CFLAGS to see that? With -O3 and -Wnonnull I cannot spot both issues with GCC 9.2.1. -- Michael --AqsLC8rIMeq19msA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl3t/8QACgkQnvQgOdby QH3vSw//SaP/bmRDA5IsQs+X46aTwU0A/rsQLyIBDNlaHb/fvDs6YG+TUsP7KiWL flWvf17RXGCIf2qU8s8Cjmpy+TqNDDWgtSKcTs0+yC6Q8PmIdBim4mJnKJBRHOaZ GWr/82MCqMtaU3OZQkSYuuEt3L/y86zxELzh1QAZVrQ1XuKlgSkyI/z61W59pUsE S1Zi6pF6bDBf+ldsQGMCkZG7Zzs00mpyoO92ByzVMFf85/z5uLqe4bKCm0+xSmKa 0ZDvMlS5i7SvjfMKNujGxFK7HaQ5DMO+PwH/zjGAvvtv/36+x3XM14/ofbojkKIm 2+8VuNt6en0Hhnh9C+KAALeVTC6Irae6zUPVd3JNxlDeMCnEO3ks7GMuzwUkiNDl hVbz/CcmA34hFU8oxm9Z89tGv2OfWkNmBQda6LooT94gvhfRFzGAfnkq+/F4Vq8L 2Z9M0ZVggz2GVQvhHT2E2HG0k52ITrUhyPqleqwCIUA/Sg4BTX/28sHbZVn+m0VS 9N6D3YNSOHqAFFj178cpMyKy37zWUMwhfcrwwaqSJMRB6JVSWyJeOG/yF63rYdiY whKQRFrA7qWl9AdQqcAbEfgCxvffQaBHFwqQtXey+gYWC64vmUy13knlrDFTUfki acrm+5fopgtwH8cvnC+97khOsXPf/U0N66rY7UXUAnrAykaAir0= =GY5f -----END PGP SIGNATURE----- --AqsLC8rIMeq19msA--