From: Laurenz Albe <laurenz.albe@cybertec.at>
To: rekgrpth@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c
Date: Wed, 06 Dec 2023 14:55:25 +0100
Message-ID: <da26cdf3558c605244838ca899c96c8874bbe92d.camel@cybertec.at> (raw)
In-Reply-To: <18230-c68eb05e05cb9177@postgresql.org>
References: <18230-c68eb05e05cb9177@postgresql.org>
On Wed, 2023-12-06 at 04:49 +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 18230
> Logged by: RekGRpth
> Email address: rekgrpth@gmail.com
> PostgreSQL version: 16.1
> Operating system: all
> Description:
>
> All versions of PostgreSQL has redundant comparison of a local variable
> 'tzp' address with a NULL value at dt_common.c in DecodeDateTime function.
>
> ```c
> ...
> int t = 0;
> int *tzp = &t;
> ...
> if (tzp != NULL)
> ...
>
> if (tzp == NULL)
That's not really a bug, but should certainly be improved.
At fault is commit 635a0b9a864, which removed "tzp" as a parameter from
"DecodeDateTime" and replaced it with a constant pointer to 0, when it
should have done more, like remove the variable and its uses.
Do you want to write a patch?
Yours,
Laurenz Albe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: laurenz.albe@cybertec.at, rekgrpth@gmail.com
Subject: Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c
In-Reply-To: <da26cdf3558c605244838ca899c96c8874bbe92d.camel@cybertec.at>
References: <18230-c68eb05e05cb9177@postgresql.org> <da26cdf3558c605244838ca899c96c8874bbe92d.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox