https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126930
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jamborm at gcc dot gnu.org
Component|middle-end |ipa
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, so the only possibility I see is that
ipa-fnsummary.cc:points_to_local_or_readonly_memory_p is called on a
non-pointer
and we interpret value_range info as ptr_info. A deeper backtrace might
have helped. I suspect the caller from analyze_function_body is not
properly guarded.
Does the following defense fix that? I'll test/push this for consistency.
diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc
index 1d10f6dbd97..7fc87b3b944 100644
--- a/gcc/tree-ssa-alias.cc
+++ b/gcc/tree-ssa-alias.cc
@@ -224,7 +224,7 @@ ptr_deref_may_alias_global_p (tree ptr, bool
escaped_local_p)
/* If we end up with a pointer constant here that may point
to global memory. */
- if (TREE_CODE (ptr) != SSA_NAME)
+ if (TREE_CODE (ptr) != SSA_NAME || !POINTER_TYPE_P (TREE_TYPE (ptr)))
return true;
pi = SSA_NAME_PTR_INFO (ptr);
@@ -248,7 +248,7 @@ ptr_deref_may_alias_auto_p (tree ptr)
/* If we end up with a pointer constant here that may point
to local stack memory. */
- if (TREE_CODE (ptr) != SSA_NAME)
+ if (TREE_CODE (ptr) != SSA_NAME || !POINTER_TYPE_P (TREE_TYPE (ptr)))
return true;
pi = SSA_NAME_PTR_INFO (ptr);