From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Gavin Ray <ray.gavin97@gmail.com>
Cc: David Malcolm <dmalcolm@redhat.com>, "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: -fanalyzer: Questions on C vs CPP + use of GCC attr's like malloc()/access()
Date: Sat, 26 Nov 2022 17:47:52 +0000 [thread overview]
Message-ID: <CAH6eHdRXkO2jE_uk9LQ3Z=jqoRKhh=ZU1QZfQe5gP7j26KmDXw@mail.gmail.com> (raw)
In-Reply-To: <CAFtvWZMSqL_gT=mS9MsBkt6F5+tUpZ0TKzS21VCinVt-wd3JVQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 670 bytes --]
On Sat, 26 Nov 2022, 15:48 Gavin Ray, <ray.gavin97@gmail.com> wrote:
> I was using if (fd != -1) and was still getting the warning which confused
> me
> My suggestion was maybe to add the exact condition the fd analyzer is
> looking for to the warning so that folks know how to fix it/trigger
> its 'true' branch.
>
> e.g. instead of:
> "fd may not be valid"
>
> Something like this, or thereabouts:
> "fd may not be valid (expecting fd >= 0)"
>
That seems like an analyzer bug, checking for -1 should be ok. POSIX is
clear that open and socket return -1 on error. I didn't check all the other
functions that return new file descriptors, but I think they're the same.
next prev parent reply other threads:[~2022-11-26 17:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 1:49 Gavin Ray
2022-11-25 17:33 ` David Malcolm
2022-11-25 18:55 ` Gavin Ray
2022-11-26 14:09 ` Jonathan Wakely
2022-11-26 15:48 ` Gavin Ray
2022-11-26 17:47 ` Jonathan Wakely [this message]
2022-11-26 18:51 ` David Malcolm
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='CAH6eHdRXkO2jE_uk9LQ3Z=jqoRKhh=ZU1QZfQe5gP7j26KmDXw@mail.gmail.com' \
--to=jwakely.gcc@gmail.com \
--cc=dmalcolm@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=ray.gavin97@gmail.com \
/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).