diff options
author | Richard Guenther <rguenther@suse.de> | 2007-05-31 21:14:52 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2007-05-31 21:14:52 +0000 |
commit | ac816b0280b8344aef4955f1cea092f6b2401edd (patch) | |
tree | ba6f9b09f627fba0cd7cb0cca6ba17e1db74915d /gcc/fortran | |
parent | ac5753b796593af16f52cdab931d1768875e5ea8 (diff) | |
download | gcc-ac816b0280b8344aef4955f1cea092f6b2401edd.zip gcc-ac816b0280b8344aef4955f1cea092f6b2401edd.tar.gz gcc-ac816b0280b8344aef4955f1cea092f6b2401edd.tar.bz2 |
trans-expr.c (gfc_conv_expr_op): Use zero constant that matches the lse type.
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.
* trans-array.c (gfc_trans_array_constructor_value): Use
index type for offset computation.
* trans-intrinsic.c (gfc_conv_associated): Use correct type
for zero constant.
From-SVN: r125242
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/fortran/intrinsic.c | 4 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 3 | ||||
-rw-r--r-- | gcc/fortran/trans-expr.c | 4 | ||||
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 2 | ||||
-rw-r--r-- | gcc/fortran/trans-types.c | 3 |
6 files changed, 23 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 025471e..f761f56 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,17 @@ +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. + * trans-array.c (gfc_trans_array_constructor_value): Use + index type for offset computation. + * trans-intrinsic.c (gfc_conv_associated): Use correct type + for zero constant. + 2007-05-31 Paul Thomas <pault@gcc.gnu.org> PR fortran/32156 diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 4114a97..69d296a 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -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_UNKNOWN, 0, REQUIRED); make_generic ("sizeof", GFC_ISYM_SIZEOF, GFC_STD_GNU); diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index a923871be..b85819e 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1196,7 +1196,8 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, gfc_add_expr_to_block (&body, tmp); *poffset = fold_build2 (PLUS_EXPR, gfc_array_index_type, - *poffset, build_int_cst (NULL_TREE, n)); + *poffset, + build_int_cst (gfc_array_index_type, n)); } if (!INTEGER_CST_P (*poffset)) { diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index c3981d7..407098e 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1149,7 +1149,7 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr * 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 * block, tree dlength, tree dest, /* 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: diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 9a27b36..801d28c 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -3271,7 +3271,7 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) tmp = gfc_conv_descriptor_stride (arg1se.expr, gfc_rank_cst[arg1->expr->rank - 1]); nonzero_arraylen = build2 (NE_EXPR, boolean_type_node, - tmp, integer_zero_node); + tmp, build_int_cst (TREE_TYPE (tmp), 0)); /* A pointer to an array, call library function _gfor_associated. */ gcc_assert (ss2 != gfc_ss_terminator); diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index db85d96..0cd284b 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -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 |