Commit 32077b69 by David Malcolm

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.
parent 7fb3669e
2020-01-14 David Malcolm <dmalcolm@redhat.com> 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 * program-state.cc (sm_state_map::clone_with_remapping): Copy
m_global_state. m_global_state.
(selftest::test_program_state_merging_2): New selftest. (selftest::test_program_state_merging_2): New selftest.
......
...@@ -5963,7 +5963,7 @@ make_region_for_type (region_id parent_rid, tree type) ...@@ -5963,7 +5963,7 @@ make_region_for_type (region_id parent_rid, tree type)
if (TREE_CODE (type) == UNION_TYPE) if (TREE_CODE (type) == UNION_TYPE)
return new union_region (parent_rid, 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); return new function_region (parent_rid, type);
/* If we have a void *, make a new symbolic region. */ /* If we have a void *, make a new symbolic region. */
......
...@@ -1202,7 +1202,7 @@ public: ...@@ -1202,7 +1202,7 @@ public:
function_region (region_id parent_rid, tree type) function_region (region_id parent_rid, tree type)
: map_region (parent_rid, 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) function_region (const function_region &other)
: map_region (other) : map_region (other)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment