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]

[PATCH] Re: Some type mismatches (fwd)


(forgot to CC gcc-patches)

So here's the complete patch, bootstrapped and tested on 
x86_64-unknown-linux-gnu.  Ok for mainline?

Thanks,
Richard.

2007-05-31  Richard Guenther  <rguenther@suse.de>

	* trans-expr.c (gfc_conv_expr_op): Use zero constant
	that matches the lse type.
	(gfc_trans_string_copy): Use sizetype zero constant.
	* intrinsic.c (add_functions): The sizeof intrinsic has
	index type result.
	* trans-types.c (gfc_get_dtype): Convert size to index
	type before shifting.

Index: trans-expr.c
===================================================================
--- trans-expr.c	(revision 125217)
+++ trans-expr.c	(working copy)
@@ -1149,7 +1149,7 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr 
 
       lse.expr = gfc_build_compare_string (lse.string_length, lse.expr,
 					   rse.string_length, rse.expr);
-      rse.expr = integer_zero_node;
+      rse.expr = build_int_cst (TREE_TYPE (lse.expr), 0);
       gfc_add_block_to_block (&lse.post, &rse.post);
     }
 
@@ -2537,7 +2537,7 @@ gfc_trans_string_copy (stmtblock_t * blo
 
   /* Do nothing if the destination length is zero.  */
   cond = fold_build2 (GT_EXPR, boolean_type_node, dlen,
-		      build_int_cst (gfc_charlen_type_node, 0));
+		      build_int_cst (size_type_node, 0));
 
   /* The following code was previously in _gfortran_copy_string:
 
Index: intrinsic.c
===================================================================
--- intrinsic.c	(revision 125217)
+++ intrinsic.c	(working copy)
@@ -2143,9 +2143,9 @@ add_functions (void)
 
   make_generic ("size", GFC_ISYM_SIZE, GFC_STD_F95);
 
-  add_sym_1 ("sizeof", GFC_ISYM_SIZEOF, NOT_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di,
+  add_sym_1 ("sizeof", GFC_ISYM_SIZEOF, NOT_ELEMENTAL, ACTUAL_NO, BT_INTEGER, ii,
 	     GFC_STD_GNU, gfc_check_sizeof, NULL, NULL,
-	     i, BT_INTEGER, di, REQUIRED);
+	     i, BT_INTEGER, ii, REQUIRED);
 
   make_generic ("sizeof", GFC_ISYM_SIZEOF, GFC_STD_GNU);
 
Index: trans-types.c
===================================================================
--- trans-types.c	(revision 125217)
+++ trans-types.c	(working copy)
@@ -993,7 +993,8 @@ gfc_get_dtype (tree type)
   if (size && !INTEGER_CST_P (size))
     {
       tmp = build_int_cst (gfc_array_index_type, GFC_DTYPE_SIZE_SHIFT);
-      tmp  = fold_build2 (LSHIFT_EXPR, gfc_array_index_type, size, tmp);
+      tmp  = fold_build2 (LSHIFT_EXPR, gfc_array_index_type,
+			  fold_convert (gfc_array_index_type, size), tmp);
       dtype = fold_build2 (PLUS_EXPR, gfc_array_index_type, tmp, dtype);
     }
   /* If we don't know the size we leave it as zero.  This should never happen


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