From: Justin Pryzby <pryzby@telsasoft.com>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Small miscellaneus fixes (Part II)
Date: Thu, 22 Dec 2022 19:08:18 -0600
Message-ID: <20221223010818.GP1153@telsasoft.com> (raw)
In-Reply-To: <CAEudQAq_1BfRhq6H6DHR_KAxYcnFjXKuWVuL7cDaBPKPtEf+4g@mail.gmail.com>
References: <CAEudQAp2R2fbbi0OHHhv_n4=Ch0t1VtjObR9YMqtGKHJ+faUFQ@mail.gmail.com>
<20221221005134.GJ1153@telsasoft.com>
<CAEudQAq_1BfRhq6H6DHR_KAxYcnFjXKuWVuL7cDaBPKPtEf+4g@mail.gmail.com>
On Thu, Dec 22, 2022 at 02:29:11PM -0300, Ranier Vilela wrote:
> Em ter., 20 de dez. de 2022 às 21:51, Justin Pryzby <pryzby@telsasoft.com> escreveu:
>
> > On Fri, Nov 25, 2022 at 06:27:04PM -0300, Ranier Vilela wrote:
> > > 5. Use boolean operator with boolean operands
> > > (b/src/backend/commands/tablecmds.c)
> >
> > tablecmds.c: right. Since 074c5cfbf
> >
> > pg_dump.c: right. Since b08dee24a
> >
> > > 4. Fix dead code (src/backend/utils/adt/formatting.c)
> > > Np->sign == '+', is different than "!= '-'" and is different than "!=
> > '+'"
> > > So the else is never hit.
> >
> > formatting.c: I don't see the problem.
> >
> > if (Np->sign != '-')
> > ...
> > else if (Np->sign != '+' && IS_PLUS(Np->Num))
> > ...
> >
> > You said that the "else" is never hit, but why ?
>
> This is a Coverity report.
>
> dead_error_condition: The condition Np->Num->flag & 0x200 cannot be true.
> 5671 else if (Np->sign != '+' && IS_PLUS(Np->Num))
>
> CID 1501076 (#1 of 1): Logically dead code (DEADCODE)dead_error_line: Execution
> cannot reach this statement: Np->Num->flag &= 0xffffffff....
>
> So, the dead code is because IS_PUS(Np->Num) is already tested and cannot
> be true on else.
Makes sense now (in your first message, you said that the problem was
with "sign", and the patch didn't address the actual problem in
IS_PLUS()).
One can look and find that the unreachable code was introduced at
7a3e7b64a.
With your proposed change, the unreachable line is hit by regression
tests, which is an improvment. As is the change to pg_dump.c.
--
Justin
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-hackers@postgresql.org
Cc: pryzby@telsasoft.com, ranier.vf@gmail.com
Subject: Re: Small miscellaneus fixes (Part II)
In-Reply-To: <20221223010818.GP1153@telsasoft.com>
References: <CAEudQAp2R2fbbi0OHHhv_n4=Ch0t1VtjObR9YMqtGKHJ+faUFQ@mail.gmail.com> <20221221005134.GJ1153@telsasoft.com> <CAEudQAq_1BfRhq6H6DHR_KAxYcnFjXKuWVuL7cDaBPKPtEf+4g@mail.gmail.com> <20221223010818.GP1153@telsasoft.com>
* 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