Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w8fo0-000ldS-0Y for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2026 14:47:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8fny-00C5Id-0U for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2026 14:47:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w8fnx-00C5IU-2L for pgsql-hackers@lists.postgresql.org; Fri, 03 Apr 2026 14:47:26 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w8fnw-00000000MtX-1UAT for pgsql-hackers@postgresql.org; Fri, 03 Apr 2026 14:47:25 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4889e045bc6so4917145e9.2 for ; Fri, 03 Apr 2026 07:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775227643; x=1775832443; darn=postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=plmlJOSAdiANyytAGLm1qNYhVOL/HaB2DI6q1NlWXbs=; b=J+nQ5mvejbsBZwV76axr7FDRDOLVzJvHp2Gl8CD+N44kYFvk5/EH2dp9jSuvmIfnuf 9uJxv2hZOZvFdj6LbUHmYqjB72CdVZJrnmK4DhbiEqyS3JfcQSjqXFyBVkdlbpamIe0r /eRSEHnNhR9k3ejXv3/iLy+I8nLfe7q5g8mSyiZ6qVmDn2dxedr9No1+oTH32LT1wD6H 9WMH9wQJCYQnKVTU8gmzreS46mkEa/naCihlysEsRdbXWfRPJc9NCiNBXYRZ8R3VzIor 1PXHefiFc5QhMzNNVGE9y+IsrQGreyiBZP/LFRqhUbKK8/jErDvlpFP50dgJK4fufV/L 5+qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775227643; x=1775832443; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=plmlJOSAdiANyytAGLm1qNYhVOL/HaB2DI6q1NlWXbs=; b=XBACTATvqtbOxA3MJ/D40WKMF60z+I+mEWvdipTcoCWDNXaxRAkpqVUCm/vdsFp5j1 6ikegHnm/XCva7kR8WaH+0/i0pTAfF0Py9LttPyRDRWAgm568uS7HP6Gl0+s8jO0jWAH +/G9YBms31jxEIxsHCAOB75/iVqZK8tOwhMqv3DnkPw5U5eBCFDks4pFuLDRwUrYdFiI B7Wleb2c9f5Tflfz/+6tye25qqiKASTdu3LKysOpbPoyd5TELTjPJ+hQOM2WpTIMvDuo B9H9a/2HchKbaODiF2mdh6fkX1pqTSrgj5gEEed3xau+XFPafD1WgHxBUn67983wH8RU vIDw== X-Gm-Message-State: AOJu0YylHuGNmRxKHHSYaY6W9NWCNwx8hFOutqL7ILfwoQ/knjZSAl3R qCWMO7TbPmbcUkii+2fNxEtvRzQFJ0MokxY7cpLwjY3w0PunkYZuPBTS X-Gm-Gg: ATEYQzy6i/bmliRNIy23EDUmLptKtmerYQEJRWD42PEuBLAMDUGpmmwKXCFqTDj6KgM AALrsNPEnnMOc+HLN05wMcf2Dqh/pA3YfdRsNDPvT5TH84+UyocJuWW2KqckqfpeNNlq/OPbG1w o8ge7Pp1JsP+pwcYGYyE3BZlonRYPLcnes6CD9aZe1gEk/pGanFvAVNgQyKOkN8xHJxhfuRVvDX 7m1JqEvBSvE5GMBzsBVzaXVkLcVDjl89Uil3KD/qqUKhLWSDTdRde79xTUQyrtusqwFxHcXyzCm AfqbRZLungVKUkM4oL+H4g7zoi4wm+lwmRj8QkPcZZD6C6v6AItpCoEXyuvgU3//Xhpx2AAFFXt 5hLifSwC/XaF31tKMcCnt9T6ZVrjeM//TwJMRAVOXzkIKEb7dIAuT7mQqwHg68nHIsn32bTjsZ2 gvMbei9gDzP1SDf53SEAKN+Qci+Mqzx/md4I3XHL54olGl8gWHGDi5FlSIysaZUv3MZpbmXJT4E 69r3cMsQBMUpMY7gH1iYocopJ5XFePsWv08YL5rR+xxCCAEYblAdDHtPw== X-Received: by 2002:a05:600c:8b54:b0:488:869c:edaa with SMTP id 5b1f17b1804b1-488996d9cdcmr54024825e9.7.1775227642612; Fri, 03 Apr 2026 07:47:22 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4888a705f99sm142839145e9.11.2026.04.03.07.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 07:47:22 -0700 (PDT) Date: Fri, 3 Apr 2026 14:47:20 +0000 From: Bertrand Drouvot To: Imran Zaheer Cc: pgsql-hackers Subject: Re: Silence -Wmaybe-uninitialized warnings Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Fri, Apr 03, 2026 at 07:14:18PM +0500, Imran Zaheer wrote: > Hi > > I pulled the latest HEAD today and found some more -Wmaybe-uninitialized > warnings. > > ``` > [1/6] Compiling C object > src/interfaces/ecpg/test/pg_regress_ecpg.p/.._.._.._test_regress_pg_regress.c.o > ../src/test/regress/pg_regress.c: In function ‘results_differ’: > ../src/test/regress/pg_regress.c:1577:17: warning: ‘startpos’ may be used > uninitialized in this function [-Wmaybe-uninitialized] > 1577 | fseek(difffile, startpos, SEEK_SET); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > [2/6] Compiling C object > src/test/isolation/pg_isolation_regress.p/.._regress_pg_regress.c.o > ../src/test/regress/pg_regress.c: In function ‘results_differ’: > ../src/test/regress/pg_regress.c:1577:17: warning: ‘startpos’ may be used > uninitialized in this function [-Wmaybe-uninitialized] > 1577 | fseek(difffile, startpos, SEEK_SET); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > [3/6] Compiling C object src/test/regress/pg_regress.p/pg_regress.c.o > ../src/test/regress/pg_regress.c: In function ‘results_differ’: > ../src/test/regress/pg_regress.c:1577:17: warning: ‘startpos’ may be used > uninitialized in this function [-Wmaybe-uninitialized] > 1577 | fseek(difffile, startpos, SEEK_SET); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ``` > > Here is the updated v2 patch addressing them. That's an "old" compiler hallucination. With an "old" one: $ gcc -Isrc/backend/postgres_lib.a.p -Isrc/include -I../src/include \ -Og -fPIC -pthread -DBUILDING_DLL -Wmaybe-uninitialized \ -o src/backend/postgres_lib.a.p/partitioning_partbounds.c.o \ -c ../src/backend/partitioning/partbounds.c ../src/backend/partitioning/partbounds.c: In function ‘check_partition_bounds_for_split_range’: ../src/backend/partitioning/partbounds.c:5452:57: warning: ‘datum’ may be used uninitialized in this function [-Wmaybe-uninitialized] 5452 | parser_errposition(pstate, exprLocation((Node *) datum))); $ gcc --version gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5) I can see the same warning that you reported. But with a more recent one: /usr/bin/gcc14-gcc -Isrc/backend/postgres_lib.a.p -Isrc/include -I../src/include \ -Og -fPIC -pthread -DBUILDING_DLL -Wmaybe-uninitialized \ -o src/backend/postgres_lib.a.p/partitioning_partbounds.c.o \ -c ../src/backend/partitioning/partbounds.c There are no warnings. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com