https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94539

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Like

diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index df9ba0de0d6..2850141303e 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -831,6 +831,15 @@ same_type_for_tbaa (tree type1, tree type2)
       && TREE_CODE (type2) == ARRAY_TYPE)
     return -1;

+  /* void * is compatible with all other pointers.  */
+  if (POINTER_TYPE_P (type1)
+      && POINTER_TYPE_P (type2)
+      && (TREE_CODE (TREE_TYPE (type1)) == VOID_TYPE
+         || TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (type1))
+         || TREE_CODE (TREE_TYPE (type2)) == VOID_TYPE
+         || TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (type2))))
+    return -1;
+
   /* ??? In Ada, an lvalue of an unconstrained type can be used to access an
      object of one of its constrained subtypes, e.g. when a function with an
      unconstrained parameter passed by reference is called on an object and

Reply via email to