OSDN Git Service

PR ada/43096
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Feb 2010 23:10:24 +0000 (23:10 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Feb 2010 23:10:24 +0000 (23:10 +0000)
* tree-ssa-alias.c (same_type_for_tbaa): Return -1 if the types have
the same alias set.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157102 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-ssa-alias.c

index 0825bc4..d506a49 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-26  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR ada/43096
+       * tree-ssa-alias.c (same_type_for_tbaa): Return -1 if the types have
+       the same alias set.
+
 2010-02-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config.gcc: Set the default arch at least to Prescott for
 2010-02-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config.gcc: Set the default arch at least to Prescott for
index b235ecc..73a1637 100644 (file)
@@ -544,13 +544,15 @@ same_type_for_tbaa (tree type1, tree type2)
       && TREE_CODE (type2) == ARRAY_TYPE)
     return -1;
 
       && TREE_CODE (type2) == ARRAY_TYPE)
     return -1;
 
-  /* In Ada, an lvalue of unconstrained type can be used to access an object
-     of one of its constrained subtypes, for example when a function with an
-     unconstrained parameter passed by reference is called on a constrained
-     object and inlined.  In this case, the types have the same alias set.  */
-  if (TYPE_SIZE (type1) && TYPE_SIZE (type2)
-      && TREE_CONSTANT (TYPE_SIZE (type1)) != TREE_CONSTANT (TYPE_SIZE (type2))
-      && get_alias_set (type1) == get_alias_set (type2))
+  /* ??? 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
+     inlined.  But, even in the case of a fixed size, type and subtypes are
+     not equivalent enough as to share the same TYPE_CANONICAL, since this
+     would mean that conversions between them are useless, whereas they are
+     not (e.g. type and subtypes can have different modes).  So, in the end,
+     they are only guaranteed to have the same alias set.  */
+  if (get_alias_set (type1) == get_alias_set (type2))
     return -1;
 
   /* The types are known to be not equal.  */
     return -1;
 
   /* The types are known to be not equal.  */