[gcc(refs/users/marxin/heads/marxin-gcc-benchmark-branch)] analyzer: fix ICE on METHOD_TYPE (PR 93212)

Martin Liska marxin@gcc.gnu.org
Mon Mar 30 10:06:58 GMT 2020


https://gcc.gnu.org/g:32077b693df8e3ed0424031a322df23822bf2f7e

commit 32077b693df8e3ed0424031a322df23822bf2f7e
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Thu Jan 9 10:12:59 2020 -0500

    analyzer: fix ICE on METHOD_TYPE (PR 93212)
    
    PR analyzer/93212 reports an ICE when attempting to use -fanalyzer
    on a C++ source file.  That isn't supported yet, but the fix is
    trivial (handling METHOD_TYPE as well as FUNCTION_TYPE).
    
    gcc/analyzer/ChangeLog:
            PR analyzer/93212
            * region-model.cc (make_region_for_type): Use
            FUNC_OR_METHOD_TYPE_P rather than comparing against FUNCTION_TYPE.
            * region-model.h (function_region::function_region): Likewise.

Diff:
---
 gcc/analyzer/ChangeLog       | 7 +++++++
 gcc/analyzer/region-model.cc | 2 +-
 gcc/analyzer/region-model.h  | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog
index 7d3b109944e..340288c08d4 100644
--- a/gcc/analyzer/ChangeLog
+++ b/gcc/analyzer/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-14  David Malcolm  <dmalcolm@redhat.com>
+
+	PR analyzer/93212
+	* region-model.cc (make_region_for_type): Use
+	FUNC_OR_METHOD_TYPE_P rather than comparing against FUNCTION_TYPE.
+	* region-model.h (function_region::function_region): Likewise.
+
 2020-01-14  David Malcolm  <dmalcolm@redhat.com>
 
 	* program-state.cc (sm_state_map::clone_with_remapping): Copy
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index b492222d64d..5c39be4fd7f 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -5963,7 +5963,7 @@ make_region_for_type (region_id parent_rid, tree type)
   if (TREE_CODE (type) == UNION_TYPE)
     return new union_region (parent_rid, type);
 
-  if (TREE_CODE (type) == FUNCTION_TYPE)
+  if (FUNC_OR_METHOD_TYPE_P (type))
     return new function_region (parent_rid, type);
 
   /* If we have a void *, make a new symbolic region.  */
diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h
index 2d0c0618bd0..eea808e61eb 100644
--- a/gcc/analyzer/region-model.h
+++ b/gcc/analyzer/region-model.h
@@ -1202,7 +1202,7 @@ public:
   function_region (region_id parent_rid, tree type)
   : map_region (parent_rid, type)
   {
-    gcc_assert (TREE_CODE (type) == FUNCTION_TYPE);
+    gcc_assert (FUNC_OR_METHOD_TYPE_P (type));
   }
   function_region (const function_region &other)
   : map_region (other)


More information about the Gcc-cvs mailing list