* tree-ssa-address.c (create_mem_ref): Do not put an expression
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 4 Mar 2007 16:23:31 +0000 (16:23 +0000)
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 4 Mar 2007 16:23:31 +0000 (16:23 +0000)
containing a cast to the base of TARGET_MEM_REF.

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

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

index 05ef84b..6b5605e 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-04  Zdenek Dvorak  <dvorakz@suse.cz>
+
+       * tree-ssa-address.c (create_mem_ref): Do not put an expression
+       containing a cast to the base of TARGET_MEM_REF.
+
 2007-03-04  Martin Michlmayr  <tbm@cyrius.com>
 
        * tree.c (tree_contains_struct_check_failed): Remove spurious
@@ -10,7 +15,7 @@
        instead of precision.
 
 2007-03-04  Roman Zippel <zippel@linux-m68k.org>
-            Nathan Sidwell  <nathan@codesourcery.com>
+           Nathan Sidwell  <nathan@codesourcery.com>
 
        * emit-rtl.c (find_auto_inc): New.
        (try_split): recreate REG_INC notes,
index ef3bfb7..44a08b9 100644 (file)
@@ -569,7 +569,7 @@ tree
 create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
 {
   tree mem_ref, tmp;
-  tree addr_type = build_pointer_type (type), atype;
+  tree atype;
   struct mem_address parts;
 
   addr_to_parts (addr, &parts);
@@ -597,18 +597,23 @@ create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
 
   if (parts.symbol)
     {
-      tmp = fold_convert (addr_type,
-                         build_addr (parts.symbol, current_function_decl));
+      tmp = build_addr (parts.symbol, current_function_decl);
+      gcc_assert (is_gimple_val (tmp));
     
       /* Add the symbol to base, eventually forcing it to register.  */
       if (parts.base)
        {
+         gcc_assert (TREE_TYPE (parts.base) == sizetype);
+
          if (parts.index)
-           parts.base = force_gimple_operand_bsi (bsi,
-                       fold_build2 (PLUS_EXPR, addr_type,
-                                    fold_convert (addr_type, parts.base),
+           {
+             atype = TREE_TYPE (tmp);
+             parts.base = force_gimple_operand_bsi (bsi,
+                       fold_build2 (PLUS_EXPR, atype,
+                                    fold_convert (atype, parts.base),
                                     tmp),
                        true, NULL_TREE);
+           }
          else
            {
              parts.index = parts.base;