From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63665 invoked by alias); 15 Mar 2017 16:51:29 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 63656 invoked by uid 89); 15 Mar 2017 16:51:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL,BAYES_50,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=cid, coverity, CID, Coverity X-HELO: mail02.lgsinnovations.com Received: from mail02.lgsinnovations.com (HELO mail02.lgsinnovations.com) (63.149.110.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 15 Mar 2017 16:51:27 +0000 Subject: Re: Dead Code To: References: <047903e6-8161-3c01-0208-13123f36196f@oarcorp.com> From: Craig Howland Message-ID: <5069a724-fac2-a2a7-a7e6-4b249a3f4aaa@LGSInnovations.com> Date: Wed, 15 Mar 2017 16:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <047903e6-8161-3c01-0208-13123f36196f@oarcorp.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LGS-EX05.lgsdirect.com (135.22.48.227) To LGS-EX01.lgsdirect.com (135.22.77.164) X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00171.txt.bz2 On 03/15/2017 11:48 AM, Joel Sherrill wrote: > Hi > > I think Coverity spotted a case where an || should be an && > in libc/string/strsignal.c. What does everyone else think? > > 74#if defined(SIGRTMIN) && defined(SIGRTMAX) > cond_at_most: Condition signal >= 27, taking false branch. Now the > value of signal is at most 26. > at_most: At condition signal <= 31, the value of signal must be at most > 26. > dead_error_condition: The condition signal <= 31 must be true. > 75 if ((signal >= SIGRTMIN) || (signal <= SIGRTMAX)) { > 76 siprintf (buffer, "Real-time signal %d", signal - SIGRTMIN); > 77 return buffer; > 78 } > 79#endif > 80 > > CID 175333 (#1 of 1): Logically dead code (DEADCODE) > dead_error_line: Execution cannot reach this statement: switch (signal) { > > case 1:.... > > --joel I agree. (Very easy to test, for that matter.) Craig