From: David Malcolm Date: Fri, 31 Jan 2020 19:05:17 +0000 (-0500) Subject: analyzer: fix ICE with 'const void *' (PR 93457) X-Git-Tag: upstream/12.2.0~18646 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6775172431a8e6f0d20ac0c4946d6b5db2f46450;p=platform%2Fupstream%2Fgcc.git analyzer: fix ICE with 'const void *' (PR 93457) gcc/analyzer/ChangeLog: PR analyzer/93457 * region-model.cc (make_region_for_type): Use VOID_TYPE_P rather than checking against void_type_node. gcc/testsuite/ChangeLog: PR analyzer/93457 * gcc.dg/analyzer/pr93457.c: New test. --- diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index 416fc92..66d46b0 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,5 +1,11 @@ 2020-01-31 David Malcolm + PR analyzer/93457 + * region-model.cc (make_region_for_type): Use VOID_TYPE_P rather + than checking against void_type_node. + +2020-01-31 David Malcolm + PR analyzer/93373 * region-model.cc (ASSERT_COMPAT_TYPES): Convert to... (assert_compat_types): ...this, and bail when either type is NULL, diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index eb6d8f3..679479c 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -6005,7 +6005,7 @@ make_region_for_type (region_id parent_rid, tree type) return new function_region (parent_rid, type); /* If we have a void *, make a new symbolic region. */ - if (type == void_type_node) + if (VOID_TYPE_P (type)) return new symbolic_region (parent_rid, false); gcc_unreachable (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d13768a..e4213d1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2020-01-31 David Malcolm + PR analyzer/93457 + * gcc.dg/analyzer/pr93457.c: New test. + +2020-01-31 David Malcolm + PR analyzer/93373 * gcc.dg/analyzer/torture/pr93373.c: New test. diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93457.c b/gcc/testsuite/gcc.dg/analyzer/pr93457.c new file mode 100644 index 0000000..b77911b --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr93457.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ + +void +p5 (const void *); + +void +s5 (const void *cl) +{ + p5 (&cl[1]); /* { dg-warning "dereferencing 'void \\*' pointer" } */ +}