Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8WXx-0000nF-Ip for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Dec 2022 01:08:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p8WXw-0008J7-Gf for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Dec 2022 01:08:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8WXw-0008Ix-30 for pgsql-hackers@lists.postgresql.org; Fri, 23 Dec 2022 01:08:24 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p8WXs-0002BM-U1 for pgsql-hackers@postgresql.org; Fri, 23 Dec 2022 01:08:22 +0000 Received: by mail-il1-x12c.google.com with SMTP id y3so1900586ilq.0 for ; Thu, 22 Dec 2022 17:08:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent: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=PaSI535smqBgKV4uwxv7tQq8R8SFlmAHCc3f4/CC+F0=; b=bTUFBx8OwmLxTL7V2/6LnS4dfG4OlRu6EgKVDfJE6+poeMqk0muxyZ7tqllMz+fF/s NfQ3veYuFULrVjkO0GUFl30s5wBu8l5J3SDFdoBYlUm1AFfPiYMTg06fqxVH/7X9bBpc OmPAJADSMfC2pitiQ/Pc0pFyiRsQaSDcBJOZxh8gN+aENShLy8LDiPheQWMJIU+3blyE gQNICW+nLQfe6ZfyrhbkHfWCZp6IcHvYbf008VkjADGRsc4V5FzXy20k2i3P142gRiNf ExbbKzAT5Llk4ix38gxoYiq0dLWElRjOGHdHTGl05G4kDYo/3ZcplsfzGPK2sk/35eq/ XA2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PaSI535smqBgKV4uwxv7tQq8R8SFlmAHCc3f4/CC+F0=; b=F5YrmsmEnoGq8kHUnzEHxCq8EapQ25GWm7xaPQbDjylfVVuVGWq/ZNQZB9XGFa/oPs Tpwva+CkGu1Mk+5TfirfvtFIOe/X9s+/VZhXk7YDCehpBT9I2p7u7O+25uT7aXQczlG7 VfqsAESPQmYeBT3RTZdd/dwjIsGDTanseY9TeNv15cT9RqptXsZqq1wkav1UTiLESCR8 5Jdp+LwW6C+WJK2yuJRqvgd0X/VK6GYnet12ICnEYqY8NT0JhDA3KZxaVr2CmGfaqewS 5Bof9YHx0aBWcs9VXYxw6qTg5Ewo+pS3K1MlHqPYvwxHoTi8r2n3Nlgl3MazEZAEvWQS YZJQ== X-Gm-Message-State: AFqh2kpqwUmhqPwU6UBF0Ur3tgsaznNj46jlVrEvTxS91pMxVW0cxC6n 2GhltWp5Rxi31anPY4eFcKCNcA== X-Google-Smtp-Source: AMrXdXufxHpJh7IlVPQ/8K8qAYEuNMWmkjylk25yA62OgkphdSA8mrZYx2jMtWeN1peVDwL9DaByZg== X-Received: by 2002:a92:7c09:0:b0:304:b837:f8e9 with SMTP id x9-20020a927c09000000b00304b837f8e9mr4718733ilc.13.1671757700035; Thu, 22 Dec 2022 17:08:20 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id x39-20020a0294aa000000b0038a0182e0casm536845jah.11.2022.12.22.17.08.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 17:08:19 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id B7996800DCC; Thu, 22 Dec 2022 19:08:18 -0600 (CST) Date: Thu, 22 Dec 2022 19:08:18 -0600 From: Justin Pryzby To: Ranier Vilela Cc: pgsql-hackers@postgresql.org Subject: Re: Small miscellaneus fixes (Part II) Message-ID: <20221223010818.GP1153@telsasoft.com> References: <20221221005134.GJ1153@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 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