mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-01 07:44:05 +08:00
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>
This commit is contained in:
parent
d2ad748eee
commit
f5a9d76be8
33
gcc/testsuite/gcc.dg/analyzer/torture/pr103685.c
Normal file
33
gcc/testsuite/gcc.dg/analyzer/torture/pr103685.c
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user