From 35bf1214af3e291cd7c17e53eadd8c96425c9fad Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 4 May 2011 13:18:34 +0000 Subject: [PATCH] 2011-05-04 Richard Guenther * trans-array.c (gfc_trans_array_constructor_value): Use size_int for bounds of range types. (gfc_trans_array_constructor_value): Use size_type_node for memcpy argument. * trans-common.c (build_field): Use gfc_charlen_type_node for lengths. * trans-openmp.c (gfc_trans_omp_clauses): Do not pass NULL as type to build_int_cst. * trans-const.c (gfc_build_string_const): Use size_int for bounds of range types. (gfc_build_wide_string_const): Likewise. * trans-stmt.c (gfc_trans_label_assign): Use gfc_charlen_type_node for lengths. (gfc_trans_character_select): Likewise. (gfc_trans_character_select): Do not pass NULL as type to build_int_cst. (gfc_trans_character_select): Use size_int for bounds of range types. * trans-io.c (gfc_build_io_library_fndecls): Likewise. (add_case): Do not pass NULL as type to build_int_cst. (transfer_expr): Likewise. (transfer_array_desc): Likewise. * trans-decl.c (gfc_add_assign_aux_vars): Use gfc_charlen_type_node for lengths. (gfc_trans_assign_aux_var): Likewise. (create_main_function): Use size_int for bounds of range types. * trans-intrinsic.c (gfc_conv_intrinsic_minmax_char): Do not pass NULL as type to build_int_cst. (gfc_conv_intrinsic_spacing): Likewise. (gfc_conv_intrinsic_rrspacing): Likewise. (gfc_conv_intrinsic_len): Use gfc_charlen_type_node for lengths. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173374 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 33 +++++++++++++++++++++++++++++++++ gcc/fortran/trans-array.c | 4 ++-- gcc/fortran/trans-common.c | 2 +- gcc/fortran/trans-const.c | 8 ++++---- gcc/fortran/trans-decl.c | 6 +++--- gcc/fortran/trans-intrinsic.c | 12 ++++++------ gcc/fortran/trans-io.c | 18 +++++++++--------- gcc/fortran/trans-openmp.c | 3 ++- gcc/fortran/trans-stmt.c | 10 ++++++---- 9 files changed, 66 insertions(+), 30 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f5e8ba6..ce33b04 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,38 @@ 2011-05-04 Richard Guenther + * trans-array.c (gfc_trans_array_constructor_value): Use + size_int for bounds of range types. + (gfc_trans_array_constructor_value): Use size_type_node + for memcpy argument. + * trans-common.c (build_field): Use gfc_charlen_type_node + for lengths. + * trans-openmp.c (gfc_trans_omp_clauses): Do not pass NULL + as type to build_int_cst. + * trans-const.c (gfc_build_string_const): Use size_int + for bounds of range types. + (gfc_build_wide_string_const): Likewise. + * trans-stmt.c (gfc_trans_label_assign): Use gfc_charlen_type_node + for lengths. + (gfc_trans_character_select): Likewise. + (gfc_trans_character_select): Do not pass NULL + as type to build_int_cst. + (gfc_trans_character_select): Use size_int for bounds of range types. + * trans-io.c (gfc_build_io_library_fndecls): Likewise. + (add_case): Do not pass NULL as type to build_int_cst. + (transfer_expr): Likewise. + (transfer_array_desc): Likewise. + * trans-decl.c (gfc_add_assign_aux_vars): Use gfc_charlen_type_node + for lengths. + (gfc_trans_assign_aux_var): Likewise. + (create_main_function): Use size_int for bounds of range types. + * trans-intrinsic.c (gfc_conv_intrinsic_minmax_char): Do not pass + NULL as type to build_int_cst. + (gfc_conv_intrinsic_spacing): Likewise. + (gfc_conv_intrinsic_rrspacing): Likewise. + (gfc_conv_intrinsic_len): Use gfc_charlen_type_node for lengths. + +2011-05-04 Richard Guenther + * trans-types.c (gfc_get_array_type_bounds): Remove zero notrunc argument to int_const_binop. diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 20138e2..a7e5f81 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1364,7 +1364,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, p = gfc_constructor_next (p); } - bound = build_int_cst (NULL_TREE, n - 1); + bound = size_int (n - 1); /* Create an array type to hold them. */ tmptype = build_range_type (gfc_array_index_type, gfc_index_zero_node, bound); @@ -1390,7 +1390,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, init = gfc_build_addr_expr (NULL_TREE, init); size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); - bound = build_int_cst (NULL_TREE, n * size); + bound = build_int_cst (size_type_node, n * size); tmp = build_call_expr_loc (input_location, built_in_decls[BUILT_IN_MEMCPY], 3, tmp, init, bound); diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c index b6318b7..c289bbe 100644 --- a/gcc/fortran/trans-common.c +++ b/gcc/fortran/trans-common.c @@ -309,7 +309,7 @@ build_field (segment_info *h, tree union_type, record_layout_info rli) addr = gfc_create_var_np (pvoid_type_node, h->sym->name); TREE_STATIC (len) = 1; TREE_STATIC (addr) = 1; - DECL_INITIAL (len) = build_int_cst (NULL_TREE, -2); + DECL_INITIAL (len) = build_int_cst (gfc_charlen_type_node, -2); gfc_set_decl_location (len, &h->sym->declared_at); gfc_set_decl_location (addr, &h->sym->declared_at); GFC_DECL_STRING_LEN (field) = pushdecl_top_level (len); diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c index 30739d8..5fbe765 100644 --- a/gcc/fortran/trans-const.c +++ b/gcc/fortran/trans-const.c @@ -75,11 +75,11 @@ gfc_build_string_const (int length, const char *s) tree len; str = build_string (length, s); - len = build_int_cst (NULL_TREE, length); + len = size_int (length); TREE_TYPE (str) = build_array_type (gfc_character1_type_node, build_range_type (gfc_charlen_type_node, - integer_one_node, len)); + size_one_node, len)); return str; } @@ -104,11 +104,11 @@ gfc_build_wide_string_const (int kind, int length, const gfc_char_t *string) str = build_string (size, s); free (s); - len = build_int_cst (NULL_TREE, length); + len = size_int (length); TREE_TYPE (str) = build_array_type (gfc_get_char_type (kind), build_range_type (gfc_charlen_type_node, - integer_one_node, len)); + size_one_node, len)); return str; } diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index f80c9db..a5527d5 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1096,7 +1096,7 @@ gfc_add_assign_aux_vars (gfc_symbol * sym) target label's address. Otherwise, value is the length of a format string and ASSIGN_ADDR is its address. */ if (TREE_STATIC (length)) - DECL_INITIAL (length) = build_int_cst (NULL_TREE, -2); + DECL_INITIAL (length) = build_int_cst (gfc_charlen_type_node, -2); else gfc_defer_symbol_init (sym); @@ -3130,7 +3130,7 @@ gfc_trans_assign_aux_var (gfc_symbol * sym, gfc_wrapped_block * block) /* Set the initial value to length. See the comments in function gfc_add_assign_aux_vars in this file. */ gfc_add_modify (&init, GFC_DECL_STRING_LEN (sym->backend_decl), - build_int_cst (NULL_TREE, -2)); + build_int_cst (gfc_charlen_type_node, -2)); gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE); } @@ -4639,7 +4639,7 @@ create_main_function (tree fndecl) gfc_option.flag_range_check)); array_type = build_array_type (integer_type_node, - build_index_type (build_int_cst (NULL_TREE, 7))); + build_index_type (size_int (7))); array = build_constructor (array_type, v); TREE_CONSTANT (array) = 1; TREE_STATIC (array) = 1; diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 10dadf7..fd538bf 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -2213,8 +2213,8 @@ gfc_conv_intrinsic_minmax_char (gfc_se * se, gfc_expr * expr, int op) args[0] = gfc_build_addr_expr (NULL_TREE, len); var = gfc_create_var (gfc_get_pchar_type (expr->ts.kind), "pstr"); args[1] = gfc_build_addr_expr (ppvoid_type_node, var); - args[2] = build_int_cst (NULL_TREE, op); - args[3] = build_int_cst (NULL_TREE, nargs / 2); + args[2] = build_int_cst (integer_type_node, op); + args[3] = build_int_cst (integer_type_node, nargs / 2); if (expr->ts.kind == 1) function = gfor_fndecl_string_minmax; @@ -4420,7 +4420,7 @@ gfc_conv_intrinsic_len (gfc_se * se, gfc_expr * expr) switch (arg->expr_type) { case EXPR_CONSTANT: - len = build_int_cst (NULL_TREE, arg->value.character.length); + len = build_int_cst (gfc_charlen_type_node, arg->value.character.length); break; case EXPR_ARRAY: @@ -4766,8 +4766,8 @@ gfc_conv_intrinsic_spacing (gfc_se * se, gfc_expr * expr) stmtblock_t block; k = gfc_validate_kind (BT_REAL, expr->ts.kind, false); - prec = build_int_cst (NULL_TREE, gfc_real_kinds[k].digits); - emin = build_int_cst (NULL_TREE, gfc_real_kinds[k].min_exponent - 1); + prec = build_int_cst (integer_type_node, gfc_real_kinds[k].digits); + emin = build_int_cst (integer_type_node, gfc_real_kinds[k].min_exponent - 1); tiny = gfc_conv_mpfr_to_tree (gfc_real_kinds[k].tiny, expr->ts.kind, 0); frexp = gfc_builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind); @@ -4850,7 +4850,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr) gfc_add_expr_to_block (&block, tmp); tmp = fold_build2_loc (input_location, MINUS_EXPR, integer_type_node, - build_int_cst (NULL_TREE, prec), e); + build_int_cst (integer_type_node, prec), e); tmp = build_call_expr_loc (input_location, scalbn, 2, x, tmp); gfc_add_modify (&block, x, tmp); stmt = gfc_finish_block (&block); diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 8021bc6..07df5d8 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -295,7 +295,7 @@ gfc_build_io_library_fndecls (void) types[IOPARM_type_pchar] = pchar_type_node; pad_size = 16 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (pchar_type_node)); pad_size += 32 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (integer_type_node)); - pad_idx = build_index_type (build_int_cst (NULL_TREE, pad_size - 1)); + pad_idx = build_index_type (size_int (pad_size - 1)); types[IOPARM_type_pad] = build_array_type (char_type_node, pad_idx); /* pad actually contains pointers and integers so it needs to have an @@ -826,7 +826,7 @@ add_case (int label_value, gfc_st_label * label, stmtblock_t * body) if (label == NULL) return; /* No label, no case */ - value = build_int_cst (NULL_TREE, label_value); + value = build_int_cst (integer_type_node, label_value); /* Make a backend label for this case. */ tmp = gfc_build_label_decl (NULL_TREE); @@ -2051,7 +2051,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code) switch (ts->type) { case BT_INTEGER: - arg2 = build_int_cst (NULL_TREE, kind); + arg2 = build_int_cst (integer_type_node, kind); if (last_dt == READ) function = iocall[IOCALL_X_INTEGER]; else @@ -2060,7 +2060,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code) break; case BT_REAL: - arg2 = build_int_cst (NULL_TREE, kind); + arg2 = build_int_cst (integer_type_node, kind); if (last_dt == READ) { if (gfc_real16_is_float128 && ts->kind == 16) @@ -2079,7 +2079,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code) break; case BT_COMPLEX: - arg2 = build_int_cst (NULL_TREE, kind); + arg2 = build_int_cst (integer_type_node, kind); if (last_dt == READ) { if (gfc_real16_is_float128 && ts->kind == 16) @@ -2098,7 +2098,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code) break; case BT_LOGICAL: - arg2 = build_int_cst (NULL_TREE, kind); + arg2 = build_int_cst (integer_type_node, kind); if (last_dt == READ) function = iocall[IOCALL_X_LOGICAL]; else @@ -2119,7 +2119,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code) arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp))); arg2 = fold_convert (gfc_charlen_type_node, arg2); } - arg3 = build_int_cst (NULL_TREE, kind); + arg3 = build_int_cst (integer_type_node, kind); if (last_dt == READ) function = iocall[IOCALL_X_CHARACTER_WIDE]; else @@ -2203,9 +2203,9 @@ transfer_array_desc (gfc_se * se, gfc_typespec * ts, tree addr_expr) if (ts->type == BT_CHARACTER) charlen_arg = se->string_length; else - charlen_arg = build_int_cst (NULL_TREE, 0); + charlen_arg = build_int_cst (gfc_charlen_type_node, 0); - kind_arg = build_int_cst (NULL_TREE, ts->kind); + kind_arg = build_int_cst (integer_type_node, ts->kind); tmp = gfc_build_addr_expr (NULL_TREE, dt_parm); if (last_dt == READ) diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 625daeb..7554889 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -948,7 +948,8 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, if (clauses->collapse) { c = build_omp_clause (where.lb->location, OMP_CLAUSE_COLLAPSE); - OMP_CLAUSE_COLLAPSE_EXPR (c) = build_int_cst (NULL, clauses->collapse); + OMP_CLAUSE_COLLAPSE_EXPR (c) + = build_int_cst (integer_type_node, clauses->collapse); omp_clauses = gfc_trans_add_clause (c, omp_clauses); } diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 7e08e8d..9147d88 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -119,7 +119,7 @@ gfc_trans_label_assign (gfc_code * code) gfc_expr *format = code->label1->format; label_len = format->value.character.length; - len_tree = build_int_cst (NULL_TREE, label_len); + len_tree = build_int_cst (gfc_charlen_type_node, label_len); label_tree = gfc_build_wide_string_const (format->ts.kind, label_len + 1, format->value.character.string); label_tree = gfc_build_addr_expr (pvoid_type_node, label_tree); @@ -2131,7 +2131,8 @@ gfc_trans_character_select (gfc_code *code) tmp = fold_build3_loc (input_location, CASE_LABEL_EXPR, void_type_node, (d->low == NULL && d->high == NULL) - ? NULL : build_int_cst (NULL_TREE, d->n), + ? NULL : build_int_cst (integer_type_node, + d->n), NULL, label); gfc_add_expr_to_block (&body, tmp); } @@ -2185,7 +2186,7 @@ gfc_trans_character_select (gfc_code *code) } type = build_array_type (select_struct[k], - build_index_type (build_int_cst (NULL_TREE, n-1))); + build_index_type (size_int (n-1))); init = build_constructor (type, inits); TREE_CONSTANT (init) = 1; @@ -2209,7 +2210,8 @@ gfc_trans_character_select (gfc_code *code) gcc_unreachable (); tmp = build_call_expr_loc (input_location, - fndecl, 4, init, build_int_cst (NULL_TREE, n), + fndecl, 4, init, + build_int_cst (gfc_charlen_type_node, n), expr1se.expr, expr1se.string_length); case_num = gfc_create_var (integer_type_node, "case_num"); gfc_add_modify (&block, case_num, tmp); -- 2.7.4