From: Hans-Peter Nilsson <hp@axis.com>
To: David Malcolm <dmalcolm@redhat.com>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 1/2] testsuite: Fix analyzer errors for newlib-errno
Date: Wed, 1 Mar 2023 16:36:46 +0100 [thread overview]
Message-ID: <20230301153646.9FF6220426@pchp3.se.axis.com> (raw)
In-Reply-To: <d85ae322723362a9fb78886215ec9eb6095b4c42.camel@redhat.com> (message from David Malcolm on Wed, 01 Mar 2023 08:32:13 -0500)
> From: David Malcolm <dmalcolm@redhat.com>
> Cc: gcc-patches@gcc.gnu.org
> Date: Wed, 01 Mar 2023 08:32:13 -0500
> Also, the analyzer uses region_model::set_errno in various
> known_function implementations, e.g. for functions that can succeed or
> fail, to set errno on the "failure" execution path to a new symbolic
> value that tests as > 0.
Ha, there's indeed errno-analyzing magic. :)
(That's the level you get when your first impression of
source code is by tracing through failing test-cases...)
> > So, how's this instead, pending full testing (only
> > analyzer.exp spot-tested)?
>
> Looks good, though how about adding a mention of newlib to the comment
> immediately above (the one that talks about Solaris and OS X)?
I deliberately didn't, as the format of that comment seemed
to ask for redundantly repeating the definition for each
system (telling exactly how the #define looks etc.), and I
thought the heading "Other implementations of C standard
library" should have been sufficient, assuming access to the
git log when there's interest in more than the first lines.
But I hear you so this is what I intend to commit later
today, just keeping the added comment as brief as
reasonable:
"analyzer: Support errno for newlib
Without this definition, the errno definition for newlib
isn't recognized as such, and these tests fail for newlib
targets:
FAIL: gcc.dg/analyzer/call-summaries-errno.c (test for warnings, line 16)
FAIL: gcc.dg/analyzer/call-summaries-errno.c (test for excess errors)
FAIL: gcc.dg/analyzer/errno-1.c (test for warnings, line 20)
FAIL: gcc.dg/analyzer/errno-1.c (test for excess errors)
FAIL: gcc.dg/analyzer/isatty-1.c (test for warnings, line 31)
FAIL: gcc.dg/analyzer/isatty-1.c (test for warnings, line 35)
FAIL: gcc.dg/analyzer/isatty-1.c (test for warnings, line 46)
FAIL: gcc.dg/analyzer/isatty-1.c (test for warnings, line 56)
FAIL: gcc.dg/analyzer/isatty-1.c (test for excess errors)
gcc/analyzer:
* kf.cc (register_known_functions): Add __errno function for newlib.
---
gcc/analyzer/kf.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gcc/analyzer/kf.cc b/gcc/analyzer/kf.cc
index 3a91b6bd6ebb..ed5f70398e1d 100644
--- a/gcc/analyzer/kf.cc
+++ b/gcc/analyzer/kf.cc
@@ -1033,9 +1033,11 @@ register_known_functions (known_function_manager &kfm)
and OS X like this:
extern int * __error(void);
#define errno (*__error())
+ and similarly __errno for newlib.
Add these as synonyms for "__errno_location". */
kfm.add ("___errno", make_unique<kf_errno_location> ());
kfm.add ("__error", make_unique<kf_errno_location> ());
+ kfm.add ("__errno", make_unique<kf_errno_location> ());
}
/* Language-specific support functions. */
--
2.30.2
> Thanks for fixing this
Thank *you* for the review!
brgds, H-P
next prev parent reply other threads:[~2023-03-01 15:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-28 18:47 Hans-Peter Nilsson
2023-02-28 19:12 ` David Malcolm
2023-03-01 0:59 ` Hans-Peter Nilsson
2023-03-01 2:25 ` David Malcolm
2023-03-01 3:01 ` Hans-Peter Nilsson
2023-03-01 13:32 ` David Malcolm
2023-03-01 15:36 ` Hans-Peter Nilsson [this message]
2023-03-01 16:02 ` Hans-Peter Nilsson
2023-03-01 23:23 ` Bernhard Reutner-Fischer
2023-03-01 23:54 ` Hans-Peter Nilsson
2023-03-02 0:37 ` Bernhard Reutner-Fischer
2023-03-02 0:58 ` Hans-Peter Nilsson
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=20230301153646.9FF6220426@pchp3.se.axis.com \
--to=hp@axis.com \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.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).