public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Craig Howland <howland@LGSInnovations.com>
To: <newlib@sourceware.org>
Subject: Re: Dead Code
Date: Wed, 15 Mar 2017 16:51:00 -0000	[thread overview]
Message-ID: <5069a724-fac2-a2a7-a7e6-4b249a3f4aaa@LGSInnovations.com> (raw)
In-Reply-To: <047903e6-8161-3c01-0208-13123f36196f@oarcorp.com>

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

  reply	other threads:[~2017-03-15 16:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15 15:49 Joel Sherrill
2017-03-15 16:51 ` Craig Howland [this message]
2017-03-15 16:59   ` Joel Sherrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5069a724-fac2-a2a7-a7e6-4b249a3f4aaa@LGSInnovations.com \
    --to=howland@lgsinnovations.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).