analyzer: fix ICE with 'const void *' (PR 93457)
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 31 Jan 2020 19:05:17 +0000 (14:05 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 31 Jan 2020 22:26:41 +0000 (17:26 -0500)
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
gcc/analyzer/region-model.cc
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/analyzer/pr93457.c [new file with mode: 0644]

index 416fc9201d33ab6bbdb5b7f5ca259ea5a0ee5dec..66d46b0dc8286c65eaa18809d04c42f04c6ef430 100644 (file)
@@ -1,3 +1,9 @@
+2020-01-31  David Malcolm  <dmalcolm@redhat.com>
+
+       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  <dmalcolm@redhat.com>
 
        PR analyzer/93373
index eb6d8f3cf3a31def603646374b4c70e8c72828ce..679479c8b5c4fc6ce79a23016ec6bf8f278d3848 100644 (file)
@@ -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 ();
index d13768a16f2796cb15f1b083fc60a167ad746e7c..e4213d1437ef3e5ed3a2942665c57feb4f7acd11 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-31  David Malcolm  <dmalcolm@redhat.com>
+
+       PR analyzer/93457
+       * gcc.dg/analyzer/pr93457.c: New test.
+
 2020-01-31  David Malcolm  <dmalcolm@redhat.com>
 
        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 (file)
index 0000000..b77911b
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+void
+p5 (const void *);
+
+void
+s5 (const void *cl)
+{
+  p5 (&cl[1]); /* { dg-warning "dereferencing 'void \\*' pointer" } */
+}