[tree-ssa] Fix compile/20030310-1.c [patch]

Diego Novillo dnovillo@redhat.com
Thu Apr 3 02:27:00 GMT 2003


Fixes the bug I described in

http://gcc.gnu.org/ml/gcc/2003-04/msg00097.html

Thanks to Jason for pointing out the bug in the inliner and
fixing the libstdc++ build failure.


Diego.



2003-04-02  Jason Merrill  <jason@redhat.com>
	    Diego Novillo  <dnovillo@redhat.com>

	* tree-inline.c (initialize_inlined_parameters): Cast argument
        types appropriately when emitting initialization assignments.
	* cp/cp-simplify.c (cp_simplify_expr) <case EMPTY_CLASS_EXPR>:
	Change type of constant to RECORD_TYPE.

Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.26.2.23
diff -d -u -p -r1.26.2.23 tree-inline.c
--- tree-inline.c	1 Apr 2003 15:21:33 -0000	1.26.2.23
+++ tree-inline.c	3 Apr 2003 01:08:25 -0000
@@ -577,16 +577,14 @@ initialize_inlined_parameters (id, args,
       if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (p)))
 	TREE_READONLY (var) = 0;
 
-      /* Initialize this VAR_DECL from the equivalent argument.  If
-	 the argument is an object, created via a constructor or copy,
-	 this will not result in an extra copy: the TARGET_EXPR
-	 representing the argument will be bound to VAR, and the
-	 object will be constructed in VAR.  */
+      /* Initialize this VAR_DECL from the equivalent argument.  Convert
+	 the argument to the proper type in case it was promoted.  */
       if (value)
 	{
 	  /* We want to use MODIFY_EXPR, not INIT_EXPR here so that we
 	     keep our trees in gimple form.  */
-	  init_stmt = build (MODIFY_EXPR, TREE_TYPE (p), var, value);
+	  init_stmt = build (MODIFY_EXPR, TREE_TYPE (var), var,
+			     convert (TREE_TYPE (var), value));
 	  init_stmts = add_stmt_to_compound (init_stmts, void_type_node,
 					     init_stmt);
 	}
Index: cp/cp-simplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/Attic/cp-simplify.c,v
retrieving revision 1.1.4.10
diff -d -u -p -r1.1.4.10 cp-simplify.c
--- cp/cp-simplify.c	7 Feb 2003 22:53:23 -0000	1.1.4.10
+++ cp/cp-simplify.c	3 Apr 2003 01:08:27 -0000
@@ -155,7 +155,12 @@ cp_simplify_expr (expr_p, pre_p, post_p)
       break;
 
     case EMPTY_CLASS_EXPR:
-      *expr_p = integer_zero_node;
+      {
+	/* Yes, an INTEGER_CST with RECORD_TYPE.  */
+	tree i = build_int_2 (0, 0);
+	TREE_TYPE (i) = TREE_TYPE (*expr_p);
+	*expr_p = i;
+      }
       return 1;
 
     case BASELINK:



More information about the Gcc-patches mailing list