summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-io.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-29 22:01:35 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-29 22:01:35 +0000
commit260abd713cecaf15b4c8803e4b609a66c6d10656 (patch)
tree5200b1c6f390cd74c55fea19d853189ee1fb3d1c /gcc/fortran/trans-io.c
parent63202938f656c4ebf907c395032137a54b8f0eb8 (diff)
downloadgcc-260abd713cecaf15b4c8803e4b609a66c6d10656.tar.gz
2004-06-29 Steven Bosscher <stevenb@suse.de>
Make sure types in assignments are compatible. Mostly mechanical. * trans-const.h (gfc_index_one_node): New define. * trans-array.c (gfc_trans_allocate_array_storage, gfc_trans_allocate_temp_array, gfc_trans_array_constructor_subarray, gfc_trans_array_constructor_value, gfc_trans_array_constructor, gfc_conv_array_ubound, gfc_conv_array_ref, gfc_trans_scalarized_loop_end, gfc_conv_section_startstride, gfc_conv_ss_startstride, gfc_conv_loop_setup, gfc_array_init_size, gfc_trans_array_bounds, gfc_trans_dummy_array_bias, gfc_conv_expr_descriptor, gfc_trans_deferred_array): Use the correct types in assignments, conversions and conditionals for expressions. * trans-expr.c (gfc_conv_expr_present, gfc_conv_substring, gfc_conv_unary_op, gfc_conv_cst_int_power, gfc_conv_string_tmp, gfc_conv_function_call, gfc_trans_pointer_assignment, gfc_trans_scalar_assign): Likewise. * trans-intrinsic.c (build_fixbound_expr, gfc_conv_intrinsic_bound, gfc_conv_intrinsic_anyall, gfc_conv_intrinsic_count, gfc_conv_intrinsic_minmaxloc, gfc_conv_intrinsic_btest, gfc_conv_intrinsic_singlebitop, gfc_conv_intrinsic_ishft, gfc_conv_intrinsic_ishftc, gfc_conv_intrinsic_strcmp, gfc_conv_allocated, gfc_conv_associated, gfc_conv_intrinsic_rrspacing, gfc_conv_intrinsic_trim): Likewise. * trans-io.c (set_string): Likewise. * trans-stmt.c (gfc_trans_do, gfc_trans_forall_loop, gfc_do_allocate, generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp, compute_inner_temp_size, compute_overall_iter_number, gfc_trans_assign_need_temp, gfc_trans_pointer_assign_need_temp, gfc_trans_forall_1, gfc_evaluate_where_mask, gfc_trans_where_assign, gfc_trans_where_2): Likewise. * trans-types.c (gfc_get_character_type, gfc_build_array_type, gfc_get_nodesc_array_type, gfc_get_array_type_bounds): Likewise. * trans.c (gfc_add_modify_expr): Add sanity check that types for the lhs and rhs are the same for scalar assignments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83877 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-io.c')
-rw-r--r--gcc/fortran/trans-io.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index f3aa37d28d8..9c4acc5e035 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -404,13 +404,14 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
len = build (COMPONENT_REF, TREE_TYPE (var_len), ioparm_var, var_len,
NULL_TREE);
- /* Integer variable assigned a format label. */
+ /* Integer variable assigned a format label. */
if (e->ts.type == BT_INTEGER && e->symtree->n.sym->attr.assign == 1)
{
msg =
gfc_build_string_const (37, "Assigned label is not a format label");
tmp = GFC_DECL_STRING_LEN (se.expr);
- tmp = build (LE_EXPR, boolean_type_node, tmp, integer_minus_one_node);
+ tmp = build (LE_EXPR, boolean_type_node,
+ tmp, convert (TREE_TYPE (tmp), integer_minus_one_node));
gfc_trans_runtime_check (tmp, msg, &se.pre);
gfc_add_modify_expr (&se.pre, io, GFC_DECL_ASSIGN_ADDR (se.expr));
gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr));
@@ -418,7 +419,7 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
else
{
gfc_conv_string_parameter (&se);
- gfc_add_modify_expr (&se.pre, io, se.expr);
+ gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr));
gfc_add_modify_expr (&se.pre, len, se.string_length);
}
@@ -432,10 +433,10 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
static void
set_flag (stmtblock_t *block, tree var)
{
- tree tmp;
+ tree tmp, type = TREE_TYPE (var);
- tmp = build (COMPONENT_REF, TREE_TYPE(var), ioparm_var, var, NULL_TREE);
- gfc_add_modify_expr (block, tmp, integer_one_node);
+ tmp = build (COMPONENT_REF, type, ioparm_var, var, NULL_TREE);
+ gfc_add_modify_expr (block, tmp, convert (type, integer_one_node));
}