public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6781] analyzer: add regression test [PR103685]
@ 2022-01-20 23:43 David Malcolm
0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2022-01-20 23:43 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:f5a9d76be849b4cf20b1b687febc34a937381dc3
commit r12-6781-gf5a9d76be849b4cf20b1b687febc34a937381dc3
Author: David Malcolm <dmalcolm@redhat.com>
Date: Wed Jan 19 12:09:09 2022 -0500
analyzer: add regression test [PR103685]
PR analyzer/103685 reports a false positive from -Wanalyzer-null-dereference
seen at -O2 with GCC 11. I can reproduce it with GCC 11, but not with
trunk; this patch adds a reduced test case that reproduces it with
GCC 11 as a regression test for GCC 12 onwards.
gcc/testsuite/ChangeLog:
PR analyzer/103685
* gcc.dg/analyzer/torture/pr103685.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diff:
---
gcc/testsuite/gcc.dg/analyzer/torture/pr103685.c | 33 ++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/pr103685.c b/gcc/testsuite/gcc.dg/analyzer/torture/pr103685.c
new file mode 100644
index 00000000000..1b222487417
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/pr103685.c
@@ -0,0 +1,33 @@
+typedef struct ec_key_st EC_KEY;
+typedef struct ec_group_st EC_GROUP;
+typedef struct R3410_ec {
+ int nid;
+ EC_GROUP *group;
+} R3410_ec_params;
+extern R3410_ec_params R3410_2012_512_paramset[];
+
+static R3410_ec_params *gost_nid2params(int nid) {
+ R3410_ec_params *params;
+
+ params = R3410_2012_512_paramset;
+ while (params->nid != 0) {
+ if (params->nid == nid)
+ return params;
+ params++;
+ }
+
+ return ((void *)0);
+}
+
+int fill_GOST_EC_params(EC_KEY *eckey, int nid) {
+ R3410_ec_params *params = gost_nid2params(nid);
+ if (!eckey || !params) {
+ return 0;
+ }
+
+ if (params->group) {
+ return 1;
+ }
+
+ return 0;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-20 23:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20 23:43 [gcc r12-6781] analyzer: add regression test [PR103685] David Malcolm
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).