Commit bc98ed60 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/45186 (Gfortran 4.5.0 emits wrong linenumbers)

2010-09-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/45186
        * trans-common.c (create_common): Change build[0-9] to
        build[0-9]_loc.
        * trans-const.c (gfc_conv_constant_to_tree,
        gfc_conv_constant_to_tree): Ditto.
        * trans-decl.c (gfc_build_qualified_array, build_entry_thunks,
        gfc_get_fake_result_decl, gfc_trans_auto_character_variable,
        add_argument_checking, create_main_function,
        gfc_generate_return): Ditto.
        * trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds):
        * Ditto.
        * trans-stmt.c (allocate_temp_for_forall_nest_1,
        compute_inner_temp_size, compute_overall_iter_number,
        generate_loop_for_rhs_to_temp, generate_loop_for_temp_to_lhs,
        gfc_conv_elemental_dependencies, gfc_do_allocate,
        gfc_evaluate_where_mask, gfc_trans_allocate,
        gfc_trans_arithmetic_if, gfc_trans_call,
        gfc_trans_character_select, gfc_trans_deallocate,
        gfc_trans_do, gfc_trans_do_while, gfc_trans_forall_1,
        gfc_trans_forall_loop, gfc_trans_goto, gfc_trans_if_1,
        gfc_trans_integer_select, gfc_trans_logical_select,
        gfc_trans_pointer_assign_need_temp, gfc_trans_return,
        gfc_trans_simple_do, gfc_trans_sync, gfc_trans_where_2,
        gfc_trans_where_assign) Ditto.

From-SVN: r163776
parent 6b8c9df8
2010-09-02 Tobias Burnus <burnus@net-b.de>
PR fortran/45186
* trans-common.c (create_common): Change build[0-9] to
build[0-9]_loc.
* trans-const.c (gfc_conv_constant_to_tree,
gfc_conv_constant_to_tree): Ditto.
* trans-decl.c (gfc_build_qualified_array, build_entry_thunks,
gfc_get_fake_result_decl, gfc_trans_auto_character_variable,
add_argument_checking, create_main_function,
gfc_generate_return): Ditto.
* trans-types.c (gfc_get_dtype, gfc_get_array_type_bounds): Ditto.
* trans-stmt.c (allocate_temp_for_forall_nest_1,
compute_inner_temp_size, compute_overall_iter_number,
generate_loop_for_rhs_to_temp, generate_loop_for_temp_to_lhs,
gfc_conv_elemental_dependencies, gfc_do_allocate,
gfc_evaluate_where_mask, gfc_trans_allocate,
gfc_trans_arithmetic_if, gfc_trans_call,
gfc_trans_character_select, gfc_trans_deallocate,
gfc_trans_do, gfc_trans_do_while, gfc_trans_forall_1,
gfc_trans_forall_loop, gfc_trans_goto, gfc_trans_if_1,
gfc_trans_integer_select, gfc_trans_logical_select,
gfc_trans_pointer_assign_need_temp, gfc_trans_return,
gfc_trans_simple_do, gfc_trans_sync, gfc_trans_where_2,
gfc_trans_where_assign) Ditto.
2010-09-02 Janus Weil <janus@gcc.gnu.org>
PR fortran/44541
......
......@@ -703,8 +703,9 @@ create_common (gfc_common_head *com, segment_info *head, bool saw_equiv)
gfc_add_decl_to_function (var_decl);
SET_DECL_VALUE_EXPR (var_decl,
fold_build3 (COMPONENT_REF, TREE_TYPE (s->field),
decl, s->field, NULL_TREE));
fold_build3_loc (input_location, COMPONENT_REF,
TREE_TYPE (s->field),
decl, s->field, NULL_TREE));
DECL_HAS_VALUE_EXPR_P (var_decl) = 1;
GFC_DECL_COMMON_OR_EQUIV (var_decl) = 1;
......
......@@ -266,29 +266,29 @@ gfc_conv_constant_to_tree (gfc_expr * expr)
{
case BT_INTEGER:
if (expr->representation.string)
return fold_build1 (VIEW_CONVERT_EXPR,
gfc_get_int_type (expr->ts.kind),
gfc_build_string_const (expr->representation.length,
expr->representation.string));
return fold_build1_loc (input_location, VIEW_CONVERT_EXPR,
gfc_get_int_type (expr->ts.kind),
gfc_build_string_const (expr->representation.length,
expr->representation.string));
else
return gfc_conv_mpz_to_tree (expr->value.integer, expr->ts.kind);
case BT_REAL:
if (expr->representation.string)
return fold_build1 (VIEW_CONVERT_EXPR,
gfc_get_real_type (expr->ts.kind),
gfc_build_string_const (expr->representation.length,
expr->representation.string));
return fold_build1_loc (input_location, VIEW_CONVERT_EXPR,
gfc_get_real_type (expr->ts.kind),
gfc_build_string_const (expr->representation.length,
expr->representation.string));
else
return gfc_conv_mpfr_to_tree (expr->value.real, expr->ts.kind, expr->is_snan);
case BT_LOGICAL:
if (expr->representation.string)
{
tree tmp = fold_build1 (VIEW_CONVERT_EXPR,
gfc_get_int_type (expr->ts.kind),
gfc_build_string_const (expr->representation.length,
expr->representation.string));
tree tmp = fold_build1_loc (input_location, VIEW_CONVERT_EXPR,
gfc_get_int_type (expr->ts.kind),
gfc_build_string_const (expr->representation.length,
expr->representation.string));
if (!integer_zerop (tmp) && !integer_onep (tmp))
gfc_warning ("Assigning value other than 0 or 1 to LOGICAL"
" has undefined result at %L", &expr->where);
......@@ -300,10 +300,10 @@ gfc_conv_constant_to_tree (gfc_expr * expr)
case BT_COMPLEX:
if (expr->representation.string)
return fold_build1 (VIEW_CONVERT_EXPR,
gfc_get_complex_type (expr->ts.kind),
gfc_build_string_const (expr->representation.length,
expr->representation.string));
return fold_build1_loc (input_location, VIEW_CONVERT_EXPR,
gfc_get_complex_type (expr->ts.kind),
gfc_build_string_const (expr->representation.length,
expr->representation.string));
else
{
tree real = gfc_conv_mpfr_to_tree (mpc_realref (expr->value.complex),
......
......@@ -724,8 +724,8 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
{
tree size, range;
size = fold_build2 (MINUS_EXPR, gfc_array_index_type,
GFC_TYPE_ARRAY_SIZE (type), gfc_index_one_node);
size = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type,
GFC_TYPE_ARRAY_SIZE (type), gfc_index_one_node);
range = build_range_type (gfc_array_index_type, gfc_index_zero_node,
size);
TYPE_DOMAIN (type) = range;
......@@ -2108,8 +2108,8 @@ build_entry_thunks (gfc_namespace * ns, bool global)
pushdecl (union_decl);
DECL_CONTEXT (union_decl) = current_function_decl;
tmp = fold_build2 (MODIFY_EXPR, TREE_TYPE (union_decl),
union_decl, tmp);
tmp = fold_build2_loc (input_location, MODIFY_EXPR,
TREE_TYPE (union_decl), union_decl, tmp);
gfc_add_expr_to_block (&body, tmp);
for (field = TYPE_FIELDS (TREE_TYPE (union_decl));
......@@ -2118,9 +2118,10 @@ build_entry_thunks (gfc_namespace * ns, bool global)
thunk_sym->result->name) == 0)
break;
gcc_assert (field != NULL_TREE);
tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (field),
union_decl, field, NULL_TREE);
tmp = fold_build2 (MODIFY_EXPR,
tmp = fold_build3_loc (input_location, COMPONENT_REF,
TREE_TYPE (field), union_decl, field,
NULL_TREE);
tmp = fold_build2_loc (input_location, MODIFY_EXPR,
TREE_TYPE (DECL_RESULT (current_function_decl)),
DECL_RESULT (current_function_decl), tmp);
tmp = build1_v (RETURN_EXPR, tmp);
......@@ -2128,7 +2129,7 @@ build_entry_thunks (gfc_namespace * ns, bool global)
else if (TREE_TYPE (DECL_RESULT (current_function_decl))
!= void_type_node)
{
tmp = fold_build2 (MODIFY_EXPR,
tmp = fold_build2_loc (input_location, MODIFY_EXPR,
TREE_TYPE (DECL_RESULT (current_function_decl)),
DECL_RESULT (current_function_decl), tmp);
tmp = build1_v (RETURN_EXPR, tmp);
......@@ -2256,8 +2257,8 @@ gfc_get_fake_result_decl (gfc_symbol * sym, int parent_flag)
break;
gcc_assert (field != NULL_TREE);
decl = fold_build3 (COMPONENT_REF, TREE_TYPE (field),
decl, field, NULL_TREE);
decl = fold_build3_loc (input_location, COMPONENT_REF,
TREE_TYPE (field), decl, field, NULL_TREE);
}
var = create_tmp_var_raw (TREE_TYPE (decl), sym->name);
......@@ -2949,7 +2950,7 @@ gfc_trans_auto_character_variable (gfc_symbol * sym, gfc_wrapped_block * block)
/* Emit a DECL_EXPR for this variable, which will cause the
gimplifier to allocate storage, and all that good stuff. */
tmp = fold_build1 (DECL_EXPR, TREE_TYPE (decl), decl);
tmp = fold_build1_loc (input_location, DECL_EXPR, TREE_TYPE (decl), decl);
gfc_add_expr_to_block (&init, tmp);
gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE);
......@@ -4198,27 +4199,29 @@ add_argument_checking (stmtblock_t *block, gfc_symbol *sym)
/* Build the condition. For optional arguments, an actual length
of 0 is also acceptable if the associated string is NULL, which
means the argument was not passed. */
cond = fold_build2 (comparison, boolean_type_node,
cl->passed_length, cl->backend_decl);
cond = fold_build2_loc (input_location, comparison, boolean_type_node,
cl->passed_length, cl->backend_decl);
if (fsym->attr.optional)
{
tree not_absent;
tree not_0length;
tree absent_failed;
not_0length = fold_build2 (NE_EXPR, boolean_type_node,
cl->passed_length,
fold_convert (gfc_charlen_type_node,
integer_zero_node));
not_0length = fold_build2_loc (input_location, NE_EXPR,
boolean_type_node,
cl->passed_length,
fold_convert (gfc_charlen_type_node,
integer_zero_node));
/* The symbol needs to be referenced for gfc_get_symbol_decl. */
fsym->attr.referenced = 1;
not_absent = gfc_conv_expr_present (fsym);
absent_failed = fold_build2 (TRUTH_OR_EXPR, boolean_type_node,
not_0length, not_absent);
absent_failed = fold_build2_loc (input_location, TRUTH_OR_EXPR,
boolean_type_node, not_0length,
not_absent);
cond = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
cond, absent_failed);
cond = fold_build2_loc (input_location, TRUTH_AND_EXPR,
boolean_type_node, cond, absent_failed);
}
/* Build the runtime check. */
......@@ -4431,8 +4434,9 @@ create_main_function (tree fndecl)
TREE_USED (fndecl) = 1;
/* "return 0". */
tmp = fold_build2 (MODIFY_EXPR, integer_type_node, DECL_RESULT (ftn_main),
build_int_cst (integer_type_node, 0));
tmp = fold_build2_loc (input_location, MODIFY_EXPR, integer_type_node,
DECL_RESULT (ftn_main),
build_int_cst (integer_type_node, 0));
tmp = build1_v (RETURN_EXPR, tmp);
gfc_add_expr_to_block (&body, tmp);
......@@ -4503,8 +4507,9 @@ gfc_generate_return (void)
if (result != NULL_TREE)
{
result = convert (TREE_TYPE (DECL_RESULT (fndecl)), result);
result = fold_build2 (MODIFY_EXPR, TREE_TYPE (result),
DECL_RESULT (fndecl), result);
result = fold_build2_loc (input_location, MODIFY_EXPR,
TREE_TYPE (result), DECL_RESULT (fndecl),
result);
}
}
......
......@@ -1360,9 +1360,11 @@ 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,
fold_convert (gfc_array_index_type, size), tmp);
dtype = fold_build2 (PLUS_EXPR, gfc_array_index_type, tmp, dtype);
tmp = fold_build2_loc (input_location, LSHIFT_EXPR,
gfc_array_index_type,
fold_convert (gfc_array_index_type, size), tmp);
dtype = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type,
tmp, dtype);
}
/* If we don't know the size we leave it as zero. This should never happen
for anything that is actually used. */
......@@ -1677,11 +1679,13 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
if (upper != NULL_TREE && lower != NULL_TREE && stride != NULL_TREE)
{
tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, upper, lower);
tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, tmp,
gfc_index_one_node);
stride =
fold_build2 (MULT_EXPR, gfc_array_index_type, tmp, stride);
tmp = fold_build2_loc (input_location, MINUS_EXPR,
gfc_array_index_type, upper, lower);
tmp = fold_build2_loc (input_location, PLUS_EXPR,
gfc_array_index_type, tmp,
gfc_index_one_node);
stride = fold_build2_loc (input_location, MULT_EXPR,
gfc_array_index_type, tmp, stride);
/* Check the folding worked. */
gcc_assert (INTEGER_CST_P (stride));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment