This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ada and TBAA and arrays vs. VIEW_CONVERT_EXPRs


> Yeah, well.  I just wanted to say that the situation in the optimizers
> may be unfortunate (may_be_nonaddressable_p misses to test
> TYPE_NONALIASED_COMPONENT, so arrays are still treated wrong).

Yes, that's exactly what I wrote in the previous message. :-)  Fixed thusly, 
tested on x86-64_suse-linux, applied on the mainline as obvious.


2009-02-08  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-ssa-loop-ivopts.c (may_be_nonaddressable_p) <VIEW_CONVERT_EXPR>:
	Make case self-contained.
	<ARRAY_REF>: Test TYPE_NONALIASED_COMPONENT flag.
ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_String_Literal_Subtype>:
	Set TYPE_NONALIASED_COMPONENT on the array type.


-- 
Eric Botcazou
Index: tree-ssa-loop-ivopts.c
===================================================================
--- tree-ssa-loop-ivopts.c	(revision 143923)
+++ tree-ssa-loop-ivopts.c	(working copy)
@@ -1562,15 +1562,14 @@ may_be_nonaddressable_p (tree expr)
 	 and make them look addressable.  After some processing the
 	 non-addressability may be uncovered again, causing ADDR_EXPRs
 	 of inappropriate objects to be built.  */
-      if (is_gimple_reg (TREE_OPERAND (expr, 0))
-	  || !is_gimple_addressable (TREE_OPERAND (expr, 0)))
-	return true;
-
-      /* ... fall through ... */
+      return is_gimple_reg (TREE_OPERAND (expr, 0))
+	     || !is_gimple_addressable (TREE_OPERAND (expr, 0))
+	     || may_be_nonaddressable_p (TREE_OPERAND (expr, 0));
 
     case ARRAY_REF:
     case ARRAY_RANGE_REF:
-      return may_be_nonaddressable_p (TREE_OPERAND (expr, 0));
+      return TYPE_NONALIASED_COMPONENT (TREE_TYPE (TREE_OPERAND (expr, 0)))
+	     || may_be_nonaddressable_p (TREE_OPERAND (expr, 0));
 
     CASE_CONVERT:
       return true;
Index: ada/gcc-interface/decl.c
===================================================================
--- ada/gcc-interface/decl.c	(revision 143923)
+++ ada/gcc-interface/decl.c	(working copy)
@@ -2615,6 +2615,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 	gnu_type
 	  = build_array_type (gnat_to_gnu_type (Component_Type (gnat_entity)),
 			      gnu_index_type);
+	TYPE_NONALIASED_COMPONENT (gnu_type) = 1;
 	copy_alias_set (gnu_type,  gnu_string_type);
       }
       break;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]