Fortran parts. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress, ok if it passes?
Thanks, Richard. 2011-05-04 Richard Guenther <rguent...@suse.de> * 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. Index: gcc/fortran/trans-array.c =================================================================== *** gcc/fortran/trans-array.c (revision 173370) --- gcc/fortran/trans-array.c (working copy) *************** gfc_trans_array_constructor_value (stmtb *** 1364,1370 **** p = gfc_constructor_next (p); } ! bound = build_int_cst (NULL_TREE, n - 1); /* Create an array type to hold them. */ tmptype = build_range_type (gfc_array_index_type, gfc_index_zero_node, bound); --- 1364,1370 ---- p = gfc_constructor_next (p); } ! 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); *************** gfc_trans_array_constructor_value (stmtb *** 1390,1396 **** 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); tmp = build_call_expr_loc (input_location, built_in_decls[BUILT_IN_MEMCPY], 3, tmp, init, bound); --- 1390,1396 ---- init = gfc_build_addr_expr (NULL_TREE, init); size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); ! 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); Index: gcc/fortran/trans-common.c =================================================================== *** gcc/fortran/trans-common.c (revision 173370) --- gcc/fortran/trans-common.c (working copy) *************** build_field (segment_info *h, tree union *** 309,315 **** 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); 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); --- 309,315 ---- 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 (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); Index: gcc/fortran/trans-openmp.c =================================================================== *** gcc/fortran/trans-openmp.c (revision 173370) --- gcc/fortran/trans-openmp.c (working copy) *************** gfc_trans_omp_clauses (stmtblock_t *bloc *** 948,954 **** 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_clauses = gfc_trans_add_clause (c, omp_clauses); } --- 948,955 ---- if (clauses->collapse) { c = build_omp_clause (where.lb->location, OMP_CLAUSE_COLLAPSE); ! OMP_CLAUSE_COLLAPSE_EXPR (c) ! = build_int_cst (integer_type_node, clauses->collapse); omp_clauses = gfc_trans_add_clause (c, omp_clauses); } Index: gcc/fortran/trans-const.c =================================================================== *** gcc/fortran/trans-const.c (revision 173370) --- gcc/fortran/trans-const.c (working copy) *************** gfc_build_string_const (int length, cons *** 75,85 **** tree len; str = build_string (length, s); ! len = build_int_cst (NULL_TREE, length); TREE_TYPE (str) = build_array_type (gfc_character1_type_node, build_range_type (gfc_charlen_type_node, ! integer_one_node, len)); return str; } --- 75,85 ---- tree len; str = build_string (length, s); ! len = size_int (length); TREE_TYPE (str) = build_array_type (gfc_character1_type_node, build_range_type (gfc_charlen_type_node, ! size_one_node, len)); return str; } *************** gfc_build_wide_string_const (int kind, i *** 104,114 **** str = build_string (size, s); free (s); ! len = build_int_cst (NULL_TREE, length); TREE_TYPE (str) = build_array_type (gfc_get_char_type (kind), build_range_type (gfc_charlen_type_node, ! integer_one_node, len)); return str; } --- 104,114 ---- str = build_string (size, s); free (s); ! len = size_int (length); TREE_TYPE (str) = build_array_type (gfc_get_char_type (kind), build_range_type (gfc_charlen_type_node, ! size_one_node, len)); return str; } Index: gcc/fortran/trans-stmt.c =================================================================== *** gcc/fortran/trans-stmt.c (revision 173370) --- gcc/fortran/trans-stmt.c (working copy) *************** gfc_trans_label_assign (gfc_code * code) *** 119,125 **** gfc_expr *format = code->label1->format; label_len = format->value.character.length; ! len_tree = build_int_cst (NULL_TREE, 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); --- 119,125 ---- gfc_expr *format = code->label1->format; label_len = format->value.character.length; ! 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); *************** gfc_trans_character_select (gfc_code *co *** 2131,2137 **** 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, label); gfc_add_expr_to_block (&body, tmp); } --- 2131,2138 ---- tmp = fold_build3_loc (input_location, CASE_LABEL_EXPR, void_type_node, (d->low == NULL && d->high == NULL) ! ? NULL : build_int_cst (integer_type_node, ! d->n), NULL, label); gfc_add_expr_to_block (&body, tmp); } *************** gfc_trans_character_select (gfc_code *co *** 2185,2191 **** } type = build_array_type (select_struct[k], ! build_index_type (build_int_cst (NULL_TREE, n-1))); init = build_constructor (type, inits); TREE_CONSTANT (init) = 1; --- 2186,2192 ---- } type = build_array_type (select_struct[k], ! build_index_type (size_int (n-1))); init = build_constructor (type, inits); TREE_CONSTANT (init) = 1; *************** gfc_trans_character_select (gfc_code *co *** 2209,2215 **** gcc_unreachable (); tmp = build_call_expr_loc (input_location, ! fndecl, 4, init, build_int_cst (NULL_TREE, n), expr1se.expr, expr1se.string_length); case_num = gfc_create_var (integer_type_node, "case_num"); gfc_add_modify (&block, case_num, tmp); --- 2210,2217 ---- gcc_unreachable (); tmp = build_call_expr_loc (input_location, ! 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); Index: gcc/fortran/trans-io.c =================================================================== *** gcc/fortran/trans-io.c (revision 173370) --- gcc/fortran/trans-io.c (working copy) *************** gfc_build_io_library_fndecls (void) *** 295,301 **** 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)); types[IOPARM_type_pad] = build_array_type (char_type_node, pad_idx); /* pad actually contains pointers and integers so it needs to have an --- 295,301 ---- 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 (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 *************** add_case (int label_value, gfc_st_label *** 826,832 **** if (label == NULL) return; /* No label, no case */ ! value = build_int_cst (NULL_TREE, label_value); /* Make a backend label for this case. */ tmp = gfc_build_label_decl (NULL_TREE); --- 826,832 ---- if (label == NULL) return; /* No label, no case */ ! value = build_int_cst (integer_type_node, label_value); /* Make a backend label for this case. */ tmp = gfc_build_label_decl (NULL_TREE); *************** transfer_expr (gfc_se * se, gfc_typespec *** 2051,2057 **** switch (ts->type) { case BT_INTEGER: ! arg2 = build_int_cst (NULL_TREE, kind); if (last_dt == READ) function = iocall[IOCALL_X_INTEGER]; else --- 2051,2057 ---- switch (ts->type) { case BT_INTEGER: ! arg2 = build_int_cst (integer_type_node, kind); if (last_dt == READ) function = iocall[IOCALL_X_INTEGER]; else *************** transfer_expr (gfc_se * se, gfc_typespec *** 2060,2066 **** break; case BT_REAL: ! arg2 = build_int_cst (NULL_TREE, kind); if (last_dt == READ) { if (gfc_real16_is_float128 && ts->kind == 16) --- 2060,2066 ---- break; case BT_REAL: ! arg2 = build_int_cst (integer_type_node, kind); if (last_dt == READ) { if (gfc_real16_is_float128 && ts->kind == 16) *************** transfer_expr (gfc_se * se, gfc_typespec *** 2079,2085 **** break; case BT_COMPLEX: ! arg2 = build_int_cst (NULL_TREE, kind); if (last_dt == READ) { if (gfc_real16_is_float128 && ts->kind == 16) --- 2079,2085 ---- break; case BT_COMPLEX: ! arg2 = build_int_cst (integer_type_node, kind); if (last_dt == READ) { if (gfc_real16_is_float128 && ts->kind == 16) *************** transfer_expr (gfc_se * se, gfc_typespec *** 2098,2104 **** break; case BT_LOGICAL: ! arg2 = build_int_cst (NULL_TREE, kind); if (last_dt == READ) function = iocall[IOCALL_X_LOGICAL]; else --- 2098,2104 ---- break; case BT_LOGICAL: ! arg2 = build_int_cst (integer_type_node, kind); if (last_dt == READ) function = iocall[IOCALL_X_LOGICAL]; else *************** transfer_expr (gfc_se * se, gfc_typespec *** 2119,2125 **** arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp))); arg2 = fold_convert (gfc_charlen_type_node, arg2); } ! arg3 = build_int_cst (NULL_TREE, kind); if (last_dt == READ) function = iocall[IOCALL_X_CHARACTER_WIDE]; else --- 2119,2125 ---- arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp))); arg2 = fold_convert (gfc_charlen_type_node, arg2); } ! arg3 = build_int_cst (integer_type_node, kind); if (last_dt == READ) function = iocall[IOCALL_X_CHARACTER_WIDE]; else *************** transfer_array_desc (gfc_se * se, gfc_ty *** 2203,2211 **** if (ts->type == BT_CHARACTER) charlen_arg = se->string_length; else ! charlen_arg = build_int_cst (NULL_TREE, 0); ! kind_arg = build_int_cst (NULL_TREE, ts->kind); tmp = gfc_build_addr_expr (NULL_TREE, dt_parm); if (last_dt == READ) --- 2203,2211 ---- if (ts->type == BT_CHARACTER) charlen_arg = se->string_length; else ! charlen_arg = build_int_cst (gfc_charlen_type_node, 0); ! kind_arg = build_int_cst (integer_type_node, ts->kind); tmp = gfc_build_addr_expr (NULL_TREE, dt_parm); if (last_dt == READ) Index: gcc/fortran/trans-decl.c =================================================================== *** gcc/fortran/trans-decl.c (revision 173370) --- gcc/fortran/trans-decl.c (working copy) *************** gfc_add_assign_aux_vars (gfc_symbol * sy *** 1096,1102 **** 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); else gfc_defer_symbol_init (sym); --- 1096,1102 ---- 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 (gfc_charlen_type_node, -2); else gfc_defer_symbol_init (sym); *************** gfc_trans_assign_aux_var (gfc_symbol * s *** 3130,3136 **** /* 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)); gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE); } --- 3130,3136 ---- /* 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 (gfc_charlen_type_node, -2)); gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE); } *************** create_main_function (tree fndecl) *** 4639,4645 **** gfc_option.flag_range_check)); array_type = build_array_type (integer_type_node, ! build_index_type (build_int_cst (NULL_TREE, 7))); array = build_constructor (array_type, v); TREE_CONSTANT (array) = 1; TREE_STATIC (array) = 1; --- 4639,4645 ---- gfc_option.flag_range_check)); array_type = build_array_type (integer_type_node, ! build_index_type (size_int (7))); array = build_constructor (array_type, v); TREE_CONSTANT (array) = 1; TREE_STATIC (array) = 1; Index: gcc/fortran/trans-intrinsic.c =================================================================== *** gcc/fortran/trans-intrinsic.c (revision 173370) --- gcc/fortran/trans-intrinsic.c (working copy) *************** gfc_conv_intrinsic_minmax_char (gfc_se * *** 2213,2220 **** 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); if (expr->ts.kind == 1) function = gfor_fndecl_string_minmax; --- 2213,2220 ---- 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 (integer_type_node, op); ! args[3] = build_int_cst (integer_type_node, nargs / 2); if (expr->ts.kind == 1) function = gfor_fndecl_string_minmax; *************** gfc_conv_intrinsic_len (gfc_se * se, gfc *** 4420,4426 **** switch (arg->expr_type) { case EXPR_CONSTANT: ! len = build_int_cst (NULL_TREE, arg->value.character.length); break; case EXPR_ARRAY: --- 4420,4426 ---- switch (arg->expr_type) { case EXPR_CONSTANT: ! len = build_int_cst (gfc_charlen_type_node, arg->value.character.length); break; case EXPR_ARRAY: *************** gfc_conv_intrinsic_spacing (gfc_se * se, *** 4766,4773 **** 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); 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); --- 4766,4773 ---- stmtblock_t block; k = gfc_validate_kind (BT_REAL, expr->ts.kind, false); ! 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); *************** gfc_conv_intrinsic_rrspacing (gfc_se * s *** 4850,4856 **** 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); tmp = build_call_expr_loc (input_location, scalbn, 2, x, tmp); gfc_add_modify (&block, x, tmp); stmt = gfc_finish_block (&block); --- 4850,4856 ---- gfc_add_expr_to_block (&block, tmp); tmp = fold_build2_loc (input_location, MINUS_EXPR, integer_type_node, ! 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);