2009-04-27 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 27 Apr 2009 11:18:38 +0000 (11:18 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 27 Apr 2009 11:18:38 +0000 (11:18 +0000)
* tree-cfg.c (remove_useless_stmts): Verify stmts afterwards.
(verify_stmts): Dispatch to gimple/type verification code.
* tree-inline.c (remap_gimple_op_r): Work around C++ FE
issue with call argument types.

java/
PR java/38374
* constants.c (build_constants_constructor): Retain the old
pointer type as valid TYPE_POINTER_TO after patching the
type of the constant pool decl.

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

gcc/ChangeLog
gcc/java/ChangeLog
gcc/java/constants.c
gcc/tree-cfg.c
gcc/tree-inline.c

index c04bd05..74160c4 100644 (file)
@@ -1,3 +1,10 @@
+2009-04-27  Richard Guenther  <rguenther@suse.de>
+
+       * tree-cfg.c (remove_useless_stmts): Verify stmts afterwards.
+       (verify_stmts): Dispatch to gimple/type verification code.
+       * tree-inline.c (remap_gimple_op_r): Work around C++ FE
+       issue with call argument types.
+
 2009-04-27  Michael Matz  <matz@suse.de>
 
        * tree-into-ssa.c (regs_to_rename, mem_syms_to_rename): Remove.
index f4f8a2a..4f7fc41 100644 (file)
@@ -1,3 +1,10 @@
+2009-04-27  Richard Guenther  <rguenther@suse.de>
+
+       PR java/38374
+       * constants.c (build_constants_constructor): Retain the old
+       pointer type as valid TYPE_POINTER_TO after patching the
+       type of the constant pool decl.
+
 2009-04-24  Ian Lance Taylor  <iant@google.com>
 
        * jcf-parse.c (handle_constant): Add cast to enum type.
index 526d9c7..70d628b 100644 (file)
@@ -557,13 +557,22 @@ build_constants_constructor (void)
       tree data_decl, tags_decl, tags_type;
       tree max_index = build_int_cst (sizetype, outgoing_cpool->count - 1);
       tree index_type = build_index_type (max_index);
+      tree tem;
 
       /* Add dummy 0'th element of constant pool. */
       tags_list = tree_cons (NULL_TREE, get_tag_node (0), tags_list);
       data_list = tree_cons (NULL_TREE, null_pointer_node, data_list);
   
+      /* Change the type of the decl to have the proper array size.
+         ???  Make sure to transition the old type-pointer-to list to this
+        new type to not invalidate all build address expressions.  */
       data_decl = build_constant_data_ref (false);
+      tem = TYPE_POINTER_TO (TREE_TYPE (data_decl));
+      if (!tem)
+       tem = build_pointer_type (TREE_TYPE (data_decl));
+      TYPE_POINTER_TO (TREE_TYPE (data_decl)) = NULL_TREE;
       TREE_TYPE (data_decl) = build_array_type (ptr_type_node, index_type);
+      TYPE_POINTER_TO (TREE_TYPE (data_decl)) = tem;
       DECL_INITIAL (data_decl) = build_constructor_from_list
                                  (TREE_TYPE (data_decl), data_list);
       DECL_SIZE (data_decl) = TYPE_SIZE (TREE_TYPE (data_decl));
index 329932d..78f82a2 100644 (file)
@@ -2084,6 +2084,11 @@ remove_useless_stmts (void)
       remove_useless_stmts_1 (&gsi, &data);
     }
   while (data.repeat);
+
+#ifdef ENABLE_TYPES_CHECKING
+  verify_types_in_gimple_seq (gimple_body (current_function_decl));
+#endif
+
   return 0;
 }
 
@@ -4313,6 +4318,14 @@ verify_stmts (void)
                  err |= true;
                }
            }
+
+#ifdef ENABLE_TYPES_CHECKING
+         if (verify_gimple_phi (phi))
+           {
+             debug_gimple_stmt (phi);
+             err |= true;
+           }
+#endif
        }
 
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
@@ -4349,6 +4362,14 @@ verify_stmts (void)
            }
 
          err |= verify_stmt (&gsi);
+
+#ifdef ENABLE_TYPES_CHECKING
+         if (verify_types_in_gimple_stmt (gsi_stmt (gsi)))
+           {
+             debug_gimple_stmt (stmt);
+             err |= true;
+           }
+#endif
          addr = walk_gimple_op (gsi_stmt (gsi), verify_node_sharing, &wi);
          if (addr)
            {
index 9344880..b134ae5 100644 (file)
@@ -705,6 +705,13 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
       gcc_assert (new_decl);
       /* Replace this variable with the copy.  */
       STRIP_TYPE_NOPS (new_decl);
+      /* ???  The C++ frontend uses void * pointer zero to initialize
+         any other type.  This confuses the middle-end type verification.
+        As cloned bodies do not go through gimplification again the fixup
+        there doesn't trigger.  */
+      if (TREE_CODE (new_decl) == INTEGER_CST
+         && !useless_type_conversion_p (TREE_TYPE (*tp), TREE_TYPE (new_decl)))
+       new_decl = fold_convert (TREE_TYPE (*tp), new_decl);
       *tp = new_decl;
       *walk_subtrees = 0;
     }