]> gcc.gnu.org Git - gcc.git/commitdiff
tree-dfa.c (refs_may_alias_p): Re-instantiate case that a scalar variable can be...
authorRichard Guenther <rguenther@suse.de>
Sat, 24 May 2008 09:27:47 +0000 (09:27 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sat, 24 May 2008 09:27:47 +0000 (09:27 +0000)
2008-05-24  Richard Guenther  <rguenther@suse.de>

* tree-dfa.c (refs_may_alias_p): Re-instantiate case that
a scalar variable can be only accessed through a pointer
or a union.

From-SVN: r135846

gcc/ChangeLog
gcc/tree-dfa.c

index 2a77cf8a207197845caa9eaaa994f6dbe4d6f6ee..d036e0318ac8ae04b28c32476fa714c6571c4891 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-24  Richard Guenther  <rguenther@suse.de>
+
+       * tree-dfa.c (refs_may_alias_p): Re-instantiate case that
+       a scalar variable can be only accessed through a pointer
+       or a union.
+
 2008-05-24  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * builtins.c (fold_builtin_fpclassify): Fix spelling of FP_INFINITE.
index 02d2139d3b3eb151cb17dc68146393089878cc07..7e4bb7681b7b92c107377d3eb53d743ff0300c42 100644 (file)
@@ -1078,8 +1078,23 @@ refs_may_alias_p (tree ref1, tree ref2)
 
   /* If one base is a ref-all pointer weird things are allowed.  */
   strict_aliasing_applies = (flag_strict_aliasing
-                            && get_alias_set (base1) != 0
-                            && get_alias_set (base2) != 0);
+                            && (!INDIRECT_REF_P (base1)
+                                || get_alias_set (base1) != 0)
+                            && (!INDIRECT_REF_P (base2)
+                                || get_alias_set (base2) != 0));
+
+  /* If strict aliasing applies the only way to access a scalar variable
+     is through a pointer dereference or through a union (gcc extension).  */
+  if (strict_aliasing_applies
+      && ((SSA_VAR_P (ref2)
+          && !AGGREGATE_TYPE_P (TREE_TYPE (ref2))
+          && !INDIRECT_REF_P (ref1)
+          && TREE_CODE (TREE_TYPE (base1)) != UNION_TYPE)
+         || (SSA_VAR_P (ref1)
+             && !AGGREGATE_TYPE_P (TREE_TYPE (ref1))
+             && !INDIRECT_REF_P (ref2)
+             && TREE_CODE (TREE_TYPE (base2)) != UNION_TYPE)))
+    return false;
 
   /* If both references are through the same type, or if strict aliasing
      doesn't apply they are through two same pointers, they do not alias
This page took 0.073427 seconds and 5 git commands to generate.