From 6775172431a8e6f0d20ac0c4946d6b5db2f46450 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 31 Jan 2020 14:05:17 -0500 Subject: [PATCH] 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. --- gcc/analyzer/ChangeLog | 6 ++++++ gcc/analyzer/region-model.cc | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/analyzer/pr93457.c | 10 ++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr93457.c diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index 416fc9201d3..66d46b0dc82 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index eb6d8f3cf3a..679479c8b5c 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 d13768a16f2..e4213d1437e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-01-31 David Malcolm + + PR analyzer/93457 + * gcc.dg/analyzer/pr93457.c: New test. + 2020-01-31 David Malcolm PR analyzer/93373 diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93457.c b/gcc/testsuite/gcc.dg/analyzer/pr93457.c new file mode 100644 index 00000000000..b77911ba789 --- /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" } */ +} -- 2.30.2