aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2009-07-16 22:29:52 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2009-07-16 22:29:52 +0000
commitdb3927fb49c9f13a0da61a75d771f51dc7c45b92 (patch)
treee4de0ffc0a0ca77f35b03bf9e8a248a4b5735f6a /gcc/fortran/trans.c
parentc32097d8b4fb21997c571cf6520431fa7d06090f (diff)
downloadgcc-db3927fb49c9f13a0da61a75d771f51dc7c45b92.zip
gcc-db3927fb49c9f13a0da61a75d771f51dc7c45b92.tar.gz
gcc-db3927fb49c9f13a0da61a75d771f51dc7c45b92.tar.bz2
re PR c/40435 (Revision 148442 caused many regressions on trunk)
2009-07-17 Aldy Hernandez <aldyh@redhat.com> Manuel López-Ibáñez <manu@gcc.gnu.org> PR 40435 * tree-complex.c, tree-loop-distribution.c, tree.c, tree.h, builtins.c, fold-const.c, omp-low.c, cgraphunit.c, tree-ssa-ccp.c, tree-ssa-dom.c, gimple-low.c, expr.c, tree-ssa-ifcombine.c, c-decl.c, stor-layout.c, tree-if-conv.c, c-typeck.c, gimplify.c, calls.c, tree-sra.c, tree-mudflap.c, tree-ssa-copy.c, tree-ssa-forwprop.c, c-convert.c, c-omp.c, varasm.c, tree-inline.c, c-common.c, c-common.h, gimple.c, tree-switch-conversion.c, gimple.h, tree-cfg.c, c-parser.c, convert.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. objc/ * objc-act.c: Add location argument to all calls to build_fold_addr_expr. testsuite/ * gcc.dg/pr36902.c: Add column info. * g++.dg/gcov/gcov-2.C: Change count for definition. cp/ * typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c, tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c, call.c, cvt.c, mangle.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. fortran/ * trans-expr.c, trans-array.c, trans-openmp.c, trans-stmt.c, trans.c, trans-io.c, trans-decl.c, trans-intrinsic.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org> From-SVN: r149722
Diffstat (limited to 'gcc/fortran/trans.c')
-rw-r--r--gcc/fortran/trans.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 319ae69..35a786a 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -339,7 +339,7 @@ gfc_build_array_ref (tree base, tree offset, tree decl)
tmp, fold_convert (sizetype, offset));
tmp = fold_convert (build_pointer_type (type), tmp);
if (!TYPE_STRING_FLAG (type))
- tmp = build_fold_indirect_ref (tmp);
+ tmp = build_fold_indirect_ref_loc (input_location, tmp);
return tmp;
}
else
@@ -413,13 +413,14 @@ gfc_trans_runtime_error_vararg (bool error, locus* where, const char* msgid,
va_end (ap);
/* Build the function call to runtime_(warning,error)_at; because of the
- variable number of arguments, we can't use build_call_expr directly. */
+ variable number of arguments, we can't use build_call_expr_loc dinput_location,
+ irectly. */
if (error)
fntype = TREE_TYPE (gfor_fndecl_runtime_error_at);
else
fntype = TREE_TYPE (gfor_fndecl_runtime_warning_at);
- tmp = fold_builtin_call_array (TREE_TYPE (fntype),
+ tmp = fold_builtin_call_array (input_location, TREE_TYPE (fntype),
fold_build1 (ADDR_EXPR,
build_pointer_type (fntype),
error
@@ -482,7 +483,8 @@ gfc_trans_runtime_check (bool error, bool once, tree cond, stmtblock_t * pblock,
cond = fold_convert (long_integer_type_node, cond);
tmp = build_int_cst (long_integer_type_node, 0);
- cond = build_call_expr (built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp);
+ cond = build_call_expr_loc (input_location,
+ built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp);
cond = fold_convert (boolean_type_node, cond);
tmp = build3_v (COND_EXPR, cond, body, build_empty_stmt (input_location));
@@ -515,7 +517,8 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size)
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Attempt to allocate a negative amount of memory."));
tmp = fold_build3 (COND_EXPR, void_type_node, negative,
- build_call_expr (gfor_fndecl_runtime_error, 1, msg),
+ build_call_expr_loc (input_location,
+ gfor_fndecl_runtime_error, 1, msg),
build_empty_stmt (input_location));
gfc_add_expr_to_block (block, tmp);
@@ -526,14 +529,16 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size)
build_int_cst (size_type_node, 1));
gfc_add_modify (&block2, res,
- build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1,
+ build_call_expr_loc (input_location,
+ built_in_decls[BUILT_IN_MALLOC], 1,
size));
null_result = fold_build2 (EQ_EXPR, boolean_type_node, res,
build_int_cst (pvoid_type_node, 0));
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Memory allocation failed"));
tmp = fold_build3 (COND_EXPR, void_type_node, null_result,
- build_call_expr (gfor_fndecl_os_error, 1, msg),
+ build_call_expr_loc (input_location,
+ gfor_fndecl_os_error, 1, msg),
build_empty_stmt (input_location));
gfc_add_expr_to_block (&block2, tmp);
malloc_result = gfc_finish_block (&block2);
@@ -615,7 +620,8 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Attempt to allocate negative amount of memory. "
"Possible integer overflow"));
- error = build_call_expr (gfor_fndecl_runtime_error, 1, msg);
+ error = build_call_expr_loc (input_location,
+ gfor_fndecl_runtime_error, 1, msg);
if (status != NULL_TREE && !integer_zerop (status))
{
@@ -624,7 +630,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
gfc_start_block (&set_status_block);
gfc_add_modify (&set_status_block,
- fold_build1 (INDIRECT_REF, status_type, status),
+ fold_build1 (INDIRECT_REF, status_type, status),
build_int_cst (status_type, LIBERROR_ALLOCATION));
gfc_add_modify (&set_status_block, res,
build_int_cst (pvoid_type_node, 0));
@@ -638,14 +644,16 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
/* The allocation itself. */
gfc_start_block (&alloc_block);
gfc_add_modify (&alloc_block, res,
- build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1,
+ build_call_expr_loc (input_location,
+ built_in_decls[BUILT_IN_MALLOC], 1,
fold_build2 (MAX_EXPR, size_type_node,
size,
build_int_cst (size_type_node, 1))));
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Out of memory"));
- tmp = build_call_expr (gfor_fndecl_os_error, 1, msg);
+ tmp = build_call_expr_loc (input_location,
+ gfor_fndecl_os_error, 1, msg);
if (status != NULL_TREE && !integer_zerop (status))
{
@@ -750,7 +758,8 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size,
stmtblock_t set_status_block;
gfc_start_block (&set_status_block);
- tmp = build_call_expr (built_in_decls[BUILT_IN_FREE], 1,
+ tmp = build_call_expr_loc (input_location,
+ built_in_decls[BUILT_IN_FREE], 1,
fold_convert (pvoid_type_node, mem));
gfc_add_expr_to_block (&set_status_block, tmp);
@@ -788,7 +797,8 @@ gfc_call_free (tree var)
var = gfc_evaluate_now (var, &block);
cond = fold_build2 (NE_EXPR, boolean_type_node, var,
build_int_cst (pvoid_type_node, 0));
- call = build_call_expr (built_in_decls[BUILT_IN_FREE], 1, var);
+ call = build_call_expr_loc (input_location,
+ built_in_decls[BUILT_IN_FREE], 1, var);
tmp = fold_build3 (COND_EXPR, void_type_node, cond, call,
build_empty_stmt (input_location));
gfc_add_expr_to_block (&block, tmp);
@@ -873,7 +883,8 @@ gfc_deallocate_with_status (tree pointer, tree status, bool can_fail,
/* When POINTER is not NULL, we free it. */
gfc_start_block (&non_null);
- tmp = build_call_expr (built_in_decls[BUILT_IN_FREE], 1,
+ tmp = build_call_expr_loc (input_location,
+ built_in_decls[BUILT_IN_FREE], 1,
fold_convert (pvoid_type_node, pointer));
gfc_add_expr_to_block (&non_null, tmp);
@@ -935,12 +946,14 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size)
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Attempt to allocate a negative amount of memory."));
tmp = fold_build3 (COND_EXPR, void_type_node, negative,
- build_call_expr (gfor_fndecl_runtime_error, 1, msg),
+ build_call_expr_loc (input_location,
+ gfor_fndecl_runtime_error, 1, msg),
build_empty_stmt (input_location));
gfc_add_expr_to_block (block, tmp);
/* Call realloc and check the result. */
- tmp = build_call_expr (built_in_decls[BUILT_IN_REALLOC], 2,
+ tmp = build_call_expr_loc (input_location,
+ built_in_decls[BUILT_IN_REALLOC], 2,
fold_convert (pvoid_type_node, mem), size);
gfc_add_modify (block, res, fold_convert (type, tmp));
null_result = fold_build2 (EQ_EXPR, boolean_type_node, res,
@@ -952,7 +965,8 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size)
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Out of memory"));
tmp = fold_build3 (COND_EXPR, void_type_node, null_result,
- build_call_expr (gfor_fndecl_os_error, 1, msg),
+ build_call_expr_loc (input_location,
+ gfor_fndecl_os_error, 1, msg),
build_empty_stmt (input_location));
gfc_add_expr_to_block (block, tmp);